View previous topic :: View next topic |
Author |
Message |
sheepdog Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 14 Oct 2002 Posts: 369 Location: Edison Enterprises Inc., Lake Oswego, Oregon, USA
|
Posted: Wed Oct 23, 2002 9:46 pm Post subject: mkswap --> truncating swap |
|
|
This question was posted to the install forum but no one responded and I still have the problem. Please advise:
Upon installing Gentoo 1.4, since I have 3 G of memory I made a 6 G partition for swap. However, upon doing "mkswap /dev/hdc7" I receive the reply "truncating swap area to 2097144". Is this right? Can I not have a 6 G swap? Should my swap be smaller than my RAM? Thanks.
-- Michael |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
n0n Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/411cca4b3d4b2d778e09b.jpg)
Joined: 13 Jun 2002 Posts: 355
|
Posted: Fri Oct 25, 2002 9:13 pm Post subject: |
|
|
There is a limit on swap space sizes, it looks like it might be ca. 2GB or so right now. For more information, you can take a look at the source to util-linux, inside disk-utils/mkswap.c. A bit that seemed relevant (didn't bother to replicate the math they're doing there):
Code: | /* 32bit kernels have a second limitation of 2GB, sparc64 is limited by
the size of virtual address space allocation for vmalloc */ |
And then:
Code: | /* man page now says:
The maximum useful size of a swap area now depends on the architecture.
It is roughly 2GB on i386, PPC, m68k, ARM, 1GB on sparc, 512MB on mips,
128GB on alpha and 3TB on sparc64.
*/ |
So I'm guessing it's 2GB. One easy solution is to just have multiple swap partitions, each of them 2GB. I believe that the current limit is 16 swap spaces, so you've got a lot of room to play around with.
As for how much swap you should have, I've always done 2.5x physical memory, personally. So if I had 3GB memory, I'd probably bite the bullet and do a whole 7.5GB of swap. However, I started doing this at a time when memory was a bit more scarce than it is now. When your box could only be expected to have maybe 32MB of memory, and you still had to run X, you could expect to be going out to swap quite a bit. Nowadays, my 2.5x rule might be a tad antiquated, because memory comes very cheap nowadays. I've got 512MB memory on my desktop machine, and I only very rarely go out to swap. Are you actually running something that'll eat up all that memory? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sheepdog Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 14 Oct 2002 Posts: 369 Location: Edison Enterprises Inc., Lake Oswego, Oregon, USA
|
Posted: Fri Oct 25, 2002 9:46 pm Post subject: |
|
|
Thank you for your very interesting discussion. I am running a particular application, built in-house, that currently uses up 1 G of RAM and does _not_ run at all if it has to swap. Thus the 3 G of RAM. My intention is to have enough memory so no swapping will occur, exactly because the application runs so poorly if swapped. I finely did get replies in the install forum and 2 contributors said that with that much RAM I did not need swap at all, which I found curious. Surely, I thought, if one ran out of RAM what would the operating system do without swap? Seems like it would be stuck. But they were so certain I figured Linux must have some trick to dealing with the situation. Not so?
-- Michael |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
n0n Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/411cca4b3d4b2d778e09b.jpg)
Joined: 13 Jun 2002 Posts: 355
|
Posted: Fri Oct 25, 2002 9:55 pm Post subject: |
|
|
If physical memory is exhausted, and no swap is available, then as far as I know, Bad Things will happen. Memory allocation calls will fail, and if the program whose memory allocation call failed knows how to deal with it, it'll die gracefully, otherwise it'll probably segfault or do other nasty things. In general, things will just get really dicey until memory or swap is freed up. Typically you're not going to have lasting damage or anything, but while memory's been exhaused, your machine will be having definite Issues.
The one thing UNIX systems typically don't do terribly well with is resource starvation.
So do you *need* swap if you've got 3GB? Hopefully not; generally you never want to be going out to swap if you can help it, and if your program's taking up 1GB, then I'd certainly hope that everything else combined isn't taking up more than another 2. Personally, I'd put at least 3GB of swap out there, and for my own box I'd probably end up doing 6GB (7.5, using my 2.5x metric, seems a bit too obsessive, even for me). :) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|