This is a discussion on Is a swap partition still necessary in Linux? within the Linux Operating System forums, part of the Unix Operating Systems category; --> Over in comp.sys.mac.system people are pretty emphatic in saying that OS X, with its "modern" swap file coding [1], ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Over in comp.sys.mac.system people are pretty emphatic in saying that OS X, with its "modern" swap file coding [1], does not need a dedicated swap partition and that empirical tests have shown no more than a 3% improvement in performance. Assuming this is true, wouldn't Linux virtual memory have kept up with the times? (Hey, that wholesale virtual machine switch in the middle of the 2.4.x series had to matter somehow, right?) Can we Linux users nowadays indeed expect to get away simply by making sure there's enough free space in our primary partition for swap files? [1] Though not yet modern enough to delete created swap files that aren't needed any more, requiring periodic reboots. Yeah, I can't believe it either. But this issue is separate from my question. -- Read my Deep Thoughts @ <URL:http://www.ylee.org/blog/> PERTH ----> * Cpu(s): 4.5% us, 2.3% sy, 92.8% ni, 0.1% id, 0.0% wa, 0.3% hi, 0.0% si Mem: 516960k total, 455240k used, 61720k free, 9408k buffers Swap: 2101032k total, 110344k used, 1990688k free, 188176k cached |
| |||
| Yeechang Lee wrote: > Can we Linux users nowadays indeed expect to get away > simply by making sure there's enough free space in our primary > partition for swap files? No since the system wants a swap partition, but I read a document which described a way to do what you want (but I don't remember the details sorry). IIRC basically it involved creating a loop filesystem in a file on the root partition, then mount it with losetup and point fstab to that. However I think it makes a lot of sense to have a swap partition, even on windows or osx. Since you *need* the space to keep the system running you don't want to be able to use it for other things. It just allows you to shoot yourself in the foot... |
| |||
| Yeechang Lee wrote: > > [1] Though not yet modern enough to delete created swap files that > aren't needed any more, requiring periodic reboots. Why reboot? What's wrong with 'swapoff /swap/file' followed by 'rm /swap/file' (both as root, of course)? It's not automatic, but IIRC, it works (although it's been a while since I've had to do it). |
| |||
| ["Followup-To:" header set to comp.os.linux.misc.] On Tue, 17 Aug 2004 22:50:47 +0200, Samuel Tribehou staggered into the Black Sun and said: > Yeechang Lee wrote: >> Can we Linux users nowadays indeed expect to get away simply by >> making sure there's enough free space in our primary partition for >> swap files? > No since the system wants a swap partition Oh, BS. Where'd you hear that? It's wrong. Some handholding distros may force you to create a swap partition when you use their easy installation wizards, but it's totally not necessary. Here's a selection from the fstab on my desktop: /swapfile none swap sw 0 0 ....there's a 384M file called /swapfile on / , which I created by doing this: dd if=/dev/zero of=/swapfile bs=1M count=384 sync mkswap /swapfile swapon /swapfile ....and it's been working fine for almost 2 years. > but I read a document which described a way to do what you want (but I > don't remember the details sorry). IIRC basically it involved > creating a loop filesystem in a file on the root partition, > then mount it with losetup and point fstab to that. Total overkill, and the performance would suck. You sure that wasn't for something else? > However I think it makes a lot of sense to have a swap partition A swap partition is a little faster than a swap file, and it is good to have some swap available. My desktop has 1G of RAM, though, so the need for swap is a lot less pressing than it would be if I only had 256M. -- Matt G|There is no Darkness in Eternity/But only Light too dim for us to see Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong http://www.brainbench.com / Hire me! -----------------------------/ http://crow202.dyndns.org/~mhgraham/resume |
| |||
| ["Followup-To:" header set to comp.os.linux.misc.] On 17 Aug 2004 20:21:06 GMT, Yeechang Lee <ylee@pobox.com> wrote: > Over in comp.sys.mac.system people are pretty emphatic in saying that > OS X, with its "modern" swap file coding [1], does not need a > dedicated swap partition and that empirical tests have shown no more > than a 3% improvement in performance. Assuming this is true, wouldn't > Linux virtual memory have kept up with the times? (Hey, that wholesale > virtual machine switch in the middle of the 2.4.x series had to matter > somehow, right?) Can we Linux users nowadays indeed expect to get away > simply by making sure there's enough free space in our primary > partition for swap files? > I seem to recall somewhere in the 2.6 kernel documentation it says that swap files should now be as fast as swap partitions. (Look in the post-halloweeen-* file). > [1] Though not yet modern enough to delete created swap files that > aren't needed any more, requiring periodic reboots. Yeah, I can't > believe it either. But this issue is separate from my question. > Huh? Can't you just swapoff and delete them like any other file? -- Liberals don't believe they deserve anything they own; conservatives think they're entitled to everything they've stolen. |
| |||
| Samuel Tribehou wrote: > However I think it makes a lot of sense to have a swap partition, even on > windows or osx. Since you *need* the space to keep the system running Who says you need swap? Most of my systems *never* touch swap, and some have neither a swap partition nor a swap file. |
| |||
| On Tue, 17 Aug 2004 16:51:42 -0400, John-Paul Stewart <jpstewart@binaryfoundry.ca> wrote: > > > Yeechang Lee wrote: >> >> [1] Though not yet modern enough to delete created swap files that >> aren't needed any more, requiring periodic reboots. > > Why reboot? What's wrong with 'swapoff /swap/file' followed by 'rm > /swap/file' (both as root, of course)? It's not automatic, but IIRC, it > works (although it's been a while since I've had to do it). How much RAM does the OP have and what sort of things does he want to do? That's the bottom line, isn't it? I have 128M RAM and only use my swap partition when I'm compiling a big application and when some application uses it because that's what it *chooses* to do (not because there isn't any RAM left). AC |
| |||
| John-Paul Stewart wrote: > Samuel Tribehou wrote: > >> However I think it makes a lot of sense to have a swap partition, even on >> windows or osx. Since you *need* the space to keep the system running > > > Who says you need swap? Most of my systems *never* touch swap, and some > have neither a swap partition nor a swap file. I rebooted recently to install a new kernel, but my system manages to use swap even though I have what seems to me to be a lot of memory. Now my guess is that if I did not have some swap partitions available, it would just use a little less cached space. 21:34:54 up 13 days, 13:11, 3 users, load average: 4.03, 4.09, 4.08 122 processes: 116 sleeping, 6 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 7.2% 384.4% 7.2% 0.0% 0.0% 0.0% 0.0% cpu00 2.9% 95.4% 1.4% 0.0% 0.0% 0.0% 0.1% cpu01 2.6% 95.0% 1.7% 0.3% 0.1% 0.0% 0.0% cpu02 0.9% 96.3% 2.6% 0.0% 0.0% 0.0% 0.0% cpu03 0.7% 97.7% 1.4% 0.0% 0.0% 0.0% 0.0% Mem: 4125476k av, 4090112k used, 35364k free, 0k shrd, 170532k buff 1622748k actv, 1698932k in_d, 114728k in_c Swap: 8193076k av, 248k used, 8192828k free 3461284k cached -- .~. Jean-David Beyer Registered Linux User 85642. /V\ Registered Machine 241939. /( )\ Shrewsbury, New Jersey http://counter.li.org ^^-^^ 21:30:00 up 13 days, 13:06, 3 users, load average: 4.08, 4.10, 4.09 |
| |||
| On Tue, 17 Aug 2004 23:34:07 GMT, Alan Connor <zzzzzz@xxx.yyy> wrote: > On Tue, 17 Aug 2004 16:51:42 -0400, John-Paul Stewart <jpstewart@binaryfoundry.ca> wrote: >> >> >> Yeechang Lee wrote: >>> >>> [1] Though not yet modern enough to delete created swap files that >>> aren't needed any more, requiring periodic reboots. >> >> Why reboot? What's wrong with 'swapoff /swap/file' followed by 'rm >> /swap/file' (both as root, of course)? It's not automatic, but IIRC, it >> works (although it's been a while since I've had to do it). > > How much RAM does the OP have and what sort of things does he want to do? > > That's the bottom line, isn't it? > > I have 128M RAM and only use my swap partition when I'm compiling a big > application and when some application uses it because that's what it > *chooses* to do (not because there isn't any RAM left). My 192 MB laptop has no swap and does not need any. I did create one when installing Linux, but that has now been reformated and turned into /var. So my desktop (was 512 MB, now 1 GB) certainly needs no swap. -- David Efflandt - All spam ignored http://www.de-srv.com/ |
| ||||
| [John-Paul Stewart] >> [1] Though not yet modern enough to delete created swap files that >> aren't needed any more, requiring periodic reboots. > Why reboot? What's wrong with 'swapoff /swap/file' followed by 'rm > /swap/file' (both as root, of course)? I suppose the OP was talking about MacOS here? > It's not automatic, but IIRC, it > works (although it's been a while since I've had to do it). It shouldn't be difficult to make a user-space program that did create more swap space on demand, and released it off-demand, though it would probably be nifty to have such a feature in the kernel anyway. -- Tobias Brox - http://www.cs.uit.no/~tobias/ Freelance programmer - +47 917 000 50 Check our Mobster game at http://mobster.td.org.uit.no/ |