![]() |
Swap partition size limit and recommendations
I scoured ITT and the net via Google and couldn't find much info on this subject. So I'm going to start a new thread. Since I'm relatively new here I don't know if this is the best area for the thread, but I don't know where else to put it since it applies to N800/810 and OS2007/2008.
Please note: Quote:
I just now set up a swap partition to replace the Nokia FAT swapfile. I have a 2GB internal SD card which was partitioned into two primary partitions. The second partition is formatted as ext2 for a dual-boot setup. The first partition was set up as fat32, but since I have no use or desire for dos partitions I decided to resize it and convert it to a swap partition which wouldn't be dismounted (causing insufficient memory problems) when the tablet is connected via USB. Since I didn't feel like resizing the partition right away, I decided it would be easier just to make the whole 1GB as swap and see if that worked. So after creating the partition, running mkswap and then swapon I looked to see if it works. Here is the output of free: Quote:
So here is the question for discussion: What is the optimal size for swap on the N800/810 and what is the max? Normally the recommended size for swap (for any OS) is Quote:
|
Re: Swap partition size limit and recommendations
Just one little observation:
Holy @#%$^ it's a lot faster faster :D Update: The speed increase seems to be more related to the swap type rather than size. In its present configuration the tablet seems more contrained by processor speed than memory. I opened up every app on the tablet at once to test swap usage. Even with 20-30 apps and videos and quake running in the background, and 10 mozilla windows open, the swap usage was only 50% of installed memory. Good news was that there was no thrashing and no crashes - except for Quiver trying to find nonexistent pictures |
Re: Swap partition size limit and recommendations
I actually did the same thing, but with about 128MB of SWAP. I don't really use the rest of the 512 card though, so I could theoretically bump it out. I noticed immediately that things ran way faster than with the swap file on a FAT32 filesystem. I thought the 128MB limit would still apply though, good to know it doesn't ;)
EDIT: I don't know if this has changed, but the tablet doesn't load swap partitions on reboot. There's a nice workaround here. I fixed the script and here it is: Code:
#!/bin/sh |
Re: Swap partition size limit and recommendations
Quote:
I already had a script, however, after scouring the net for a while to find something decent and then making my own ( swap wouldn't do much good otherwise, would it?). I still greatly appreciate your nicer looking one, though. I'll likely take yours, add it to mine and revise it a bit. It would be good if we all got on the same page with the scripts so it could be standardized, posted somewhere to help others, and maybe build a deb. The ideal situation would be to scan for existing swap partitions and mount them automagically. Then you could also have a script for users to create a new one on tablets that haven't implemented it. A couple of pointers: 1) Linux initscripts don't need or use .sh extensions. 2) 'swapon -a' mounts any swap partitions defined in fstab But first we need to know what the optimal size is, and that's what this thread is for! Come on people, what's the optimal size for the swap partition when running OpenOffice, KDE and Mplayer all at the same time. ;) |
Re: Swap partition size limit and recommendations
Note that the old "swap size should be at least 2xRAM size" advice only applies to those Unix systems where RAM is mapped to swap, that is, if you have X size RAM you _must_ also have X size swap, and then your virtual memory (VM) is still just X. Only when you add even more swap will your VM get extended.
There are only a few such systems left out there (AIX 4.x was one I think). Linux is not one of them. For Linux, the rule is: "The more RAM you have the less swap you'll need". As 128MB RAM isn't that much it's helpful with some amount of swap. But if you add too much (say, 4-5-6 times RAM size) you may experience that things actually slow down after a while, because lots of application data/code may have been pushed out to swap over the weeks (if you leave applications up and running). I haven't experimented on my N800 yet, but to start with I think I would limit myself to 512MB swap, and probably begin with just 128MB or 256MB. |
Re: Swap partition size limit and recommendations
Thanks for the post. You are quite correct.
I just used the old rule since it was easy to post. I used 1GB as a starter because I'm lazy and the partition was already there. I've since reduced it down since it had no benefit and I needed the extra space. Quote:
|
Re: Swap partition size limit and recommendations
I have an internal 8Gb card formatted as ext3. I created a 128Mb swapfile and activate it from /etc/init.d/rcS by adding the command: swapon -a /swapfile. I don't know of any advantages for a separate swap partition for the N800. Am I mistaken?
|
Re: Swap partition size limit and recommendations
A swap partition should in principle be faster than a swap file, because with a swap partition the kernel memory management system writes directly to the partition while with a swap file it'll have to go through the filesystem driver and then to the partition the file resides on (longer code and data paths)
|
Re: Swap partition size limit and recommendations
Quote:
If file is fragmented there may be some (insignificant?) overhead though. See dmesg log about number of extents when swapon is run. |
Re: Swap partition size limit and recommendations
Ah, thanks for the updated info. When swap-to-file was introduced it was an issue (and at least through the 2.2 series, not sure about 2.4 because I didn't use swap-to-file there).
Do you know if this is still true with a FAT32 file system? In principle it should, because an application like the LILO loader does the same kind of mapping you describe. But in an earlier post skeezer reported that there was a noticable difference ("way faster"). |
Re: Swap partition size limit and recommendations
Quote:
http://en.wikipedia.org/wiki/Paging#Swapping_in_Linux Quote:
|
Re: Swap partition size limit and recommendations
Could the "way faster" be because of the 1gb of swap space?
|
Re: Swap partition size limit and recommendations
Quote:
|
Re: Swap partition size limit and recommendations
I'm a newbie at swap and when I got a 32gb card several weeks ago I decided to add Diablo and dual boot from Penguinbait along with KDE. I decided to add swap feature from PB's list of options on dual boot menu. I put aside 1gb for swap. I did notice that speed of loading of apps and how many apps I could run at the same time was tremendous. I no longer have crashes on apps like Quiver. When I added Debian I put it on same card as swap and have been having trouble with loading apps int Debian. No such problems on Hildon side. Apps load fine and behave properly. It keeps telling me that I've run out of devise space. Anyone have any expertise or experience with this? My other question is do I need to use gnexus fix to use swap partition properly? Any help, guidance or advise would greatly be appreciated. TIA, Dan
Edit: Solution do not put Debian in a card that has swap partition. Major problems with Debian if you do. |
Re: Swap partition size limit and recommendations
Is there a way to add swap to a internal booting mmc clone with deablo if this will speed things up an stop the mem probs I would really like to know :) thanks
|
Re: Swap partition size limit and recommendations
Quote:
I have found that, unfortunately, flash-based devices seem unable to take good advantage of large amounts of swap memory. So currently I'm using 256MB. Unfortunately even that seems to be excessive, since I've never seen a flash-based device take advantage of anything over say 100MB. But then again with the size of the new SD cards memory is cheap, so it never hurts to have way too much. 1GB, however, is probably way too excessive. You must also remember that using swap will wear out the flash very quickly, so always have a backup of any data on your SD card. It would probably also be best to put the swap on a smaller and less expensive SD card, just in case it dies. . . |
| All times are GMT. The time now is 13:28. |
vBulletin® Version 3.8.8