linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.4 VM & swap question
@ 2001-06-17 17:48 Tom Rini
  2001-06-17 18:58 ` Jakob Østergaard
  2001-06-17 19:12 ` Dan Podeanu
  0 siblings, 2 replies; 14+ messages in thread
From: Tom Rini @ 2001-06-17 17:48 UTC (permalink / raw)
  To: linux-kernel

'lo all.  I've got a question about swap and RAM requirements in 2.4.  Now,
when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned.
But what I'm wondering is what exactly are the limits on this.  Right now
I've got an x86 box w/ 128ram and currently 256swap.  When I had 128, I'd get
low on ram/swap after some time in X, and doing this seems to 'fix' it, in
2.4.4.  However, I've also got 2 PPC boxes, both with 256:256 in 2.4.  One
of which never has X up, but lots of other activity, and swap usage seems
to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap,
18day+ uptime).  The other box is a laptop and has X up when it's awake and
that too doesn't seem to have any problem.  So what exactly is the real
minium swap ammount?

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 17:48 2.4 VM & swap question Tom Rini
@ 2001-06-17 18:58 ` Jakob Østergaard
  2001-06-17 19:06   ` Tom Rini
  2001-06-17 21:43   ` alterity
  2001-06-17 19:12 ` Dan Podeanu
  1 sibling, 2 replies; 14+ messages in thread
From: Jakob Østergaard @ 2001-06-17 18:58 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kernel

On Sun, Jun 17, 2001 at 10:48:36AM -0700, Tom Rini wrote:
> 'lo all.  I've got a question about swap and RAM requirements in 2.4.  Now,
> when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned.
> But what I'm wondering is what exactly are the limits on this.  Right now
> I've got an x86 box w/ 128ram and currently 256swap.  When I had 128, I'd get
> low on ram/swap after some time in X, and doing this seems to 'fix' it, in
> 2.4.4.  However, I've also got 2 PPC boxes, both with 256:256 in 2.4.  One
> of which never has X up, but lots of other activity, and swap usage seems
> to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap,
> 18day+ uptime).  The other box is a laptop and has X up when it's awake and
> that too doesn't seem to have any problem.  So what exactly is the real
> minium swap ammount?

It completely totally and absolutely depends on the kind of workloads you put
your system under.

I have a database server with 1G phys and 1G swap. It uses 950+ MB for cache,
as it should, and doesn't even *touch* swap.  This is 2.4.5.

I have another box with 384MB phys and 1G swap, and it's usually a few hundred
megs into swap.  That's what long-running memory hogs and big compilers do.

There is no simple answer.  swap = 2*phys may be reasonable for some desktop
uses, I don't know.  But there *is* *no* *simple* *answer*.

With the amount of work that's gone into just *understanding* why the VM
behaves as it does (even after the VM rewrite that was done exactly in order to
come up with a VM we could *understand*), it's beyond me how anyone can even
begin to think that one can define a set of simple and exact rules for minimum
or "optimal" (whatever that means) values for swap.


(if I sound pissed, don't worry, I'm not. I'm frustrated, that's different  ;)
-- 
................................................................
:   jakob@unthought.net   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 18:58 ` Jakob Østergaard
@ 2001-06-17 19:06   ` Tom Rini
  2001-06-17 21:43   ` alterity
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Rini @ 2001-06-17 19:06 UTC (permalink / raw)
  To: Jakob ?stergaard, linux-kernel

On Sun, Jun 17, 2001 at 08:58:35PM +0200, Jakob ?stergaard wrote:
> On Sun, Jun 17, 2001 at 10:48:36AM -0700, Tom Rini wrote:
> > 'lo all.  I've got a question about swap and RAM requirements in 2.4.  Now,
> > when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned.
> > But what I'm wondering is what exactly are the limits on this.  Right now
> > I've got an x86 box w/ 128ram and currently 256swap.  When I had 128, I'd get
> > low on ram/swap after some time in X, and doing this seems to 'fix' it, in
> > 2.4.4.  However, I've also got 2 PPC boxes, both with 256:256 in 2.4.  One
> > of which never has X up, but lots of other activity, and swap usage seems
> > to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap,
> > 18day+ uptime).  The other box is a laptop and has X up when it's awake and
> > that too doesn't seem to have any problem.  So what exactly is the real
> > minium swap ammount?
> 
> It completely totally and absolutely depends on the kind of workloads you put
> your system under.

Well, yes. :)  But 2.4.x is much more swap-happy then 2.2.x was.  I haven't 
changed my workload that much but the 256 swap became noticiably needed
recently.

> There is no simple answer.  swap = 2*phys may be reasonable for some desktop
> uses, I don't know.  But there *is* *no* *simple* *answer*.

Yes.  The problem is the requirement has seemingly doubled recently.

> With the amount of work that's gone into just *understanding* why the VM
> behaves as it does (even after the VM rewrite that was done exactly in order to
> come up with a VM we could *understand*), it's beyond me how anyone can even
> begin to think that one can define a set of simple and exact rules for minimum
> or "optimal" (whatever that means) values for swap.

Well, it's also been said that the 'need' for 2xswap was fixed by one of the
probably-not-yet-in-linus'-tree VM patches.  And that it's 'artificial'

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 17:48 2.4 VM & swap question Tom Rini
  2001-06-17 18:58 ` Jakob Østergaard
@ 2001-06-17 19:12 ` Dan Podeanu
  2001-06-17 19:20   ` Tom Rini
  1 sibling, 1 reply; 14+ messages in thread
From: Dan Podeanu @ 2001-06-17 19:12 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kernel

On Sun, Jun 17, 2001 at 10:48:36AM -0700, Tom Rini wrote:
> 'lo all.  I've got a question about swap and RAM requirements in 2.4.  Now,
> when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned.
> But what I'm wondering is what exactly are the limits on this.  Right now
> I've got an x86 box w/ 128ram and currently 256swap.  When I had 128, I'd get
> low on ram/swap after some time in X, and doing this seems to 'fix' it, in
> 2.4.4.  However, I've also got 2 PPC boxes, both with 256:256 in 2.4.  One
> of which never has X up, but lots of other activity, and swap usage seems
> to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap,
> 18day+ uptime).  The other box is a laptop and has X up when it's awake and
> that too doesn't seem to have any problem.  So what exactly is the real
> minium swap ammount?

I doubt there is a limit. I think 'it depends on what you're planning
to do' is the correct answer. For a blank router, 32mb ram/64 swap can
be enough, for a web/database server, you need more, etc.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 19:12 ` Dan Podeanu
@ 2001-06-17 19:20   ` Tom Rini
  2001-06-17 19:31     ` Dan Podeanu
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2001-06-17 19:20 UTC (permalink / raw)
  To: linux-kernel

On Sun, Jun 17, 2001 at 10:12:39PM +0300, Dan Podeanu wrote:
> On Sun, Jun 17, 2001 at 10:48:36AM -0700, Tom Rini wrote:
> > 'lo all.  I've got a question about swap and RAM requirements in 2.4.  Now,
> > when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned.
> > But what I'm wondering is what exactly are the limits on this.  Right now
> > I've got an x86 box w/ 128ram and currently 256swap.  When I had 128, I'd get
> > low on ram/swap after some time in X, and doing this seems to 'fix' it, in
> > 2.4.4.  However, I've also got 2 PPC boxes, both with 256:256 in 2.4.  One
> > of which never has X up, but lots of other activity, and swap usage seems
> > to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap,
> > 18day+ uptime).  The other box is a laptop and has X up when it's awake and
> > that too doesn't seem to have any problem.  So what exactly is the real
> > minium swap ammount?
> 
> I doubt there is a limit. I think 'it depends on what you're planning
> to do' is the correct answer. For a blank router, 32mb ram/64 swap can
> be enough, for a web/database server, you need more, etc.

Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one
needs that will always work.  However, in 2.2 for a 'workstation' one could
usually quite happily get away with having 128:128 and never have much of a
problem.  with 2.4.0 and up this isn't the case.  This has been the cause
of many people complaining quite loudly about 2.4 VM sucking and having
lots of OOM kills going about.  It's also been called an 'aritificial limit'
since one of the VM people had a patch to 'fix' this.  What I'm trying to
figure out is if this problem exists linearly or just with 'lower' ammounts
of total physical ram.  ie if I jump up to 512mb and don't have a webserver
or database (ie I've got 512mb so I end up with a big disk cache) will I need
to have 1gb of swap just to keep the VM happy?  Will 256 be enough?  Could I
even live w/o swap?

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 19:20   ` Tom Rini
@ 2001-06-17 19:31     ` Dan Podeanu
  2001-06-17 19:33       ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Dan Podeanu @ 2001-06-17 19:31 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kernel

> Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one
> needs that will always work.  However, in 2.2 for a 'workstation' one could
> usually quite happily get away with having 128:128 and never have much of a
> problem.  with 2.4.0 and up this isn't the case.  This has been the cause
> of many people complaining quite loudly about 2.4 VM sucking and having
> lots of OOM kills going about.  It's also been called an 'aritificial limit'
> since one of the VM people had a patch to 'fix' this.  What I'm trying to
> figure out is if this problem exists linearly or just with 'lower' ammounts
> of total physical ram.  ie if I jump up to 512mb and don't have a webserver
> or database (ie I've got 512mb so I end up with a big disk cache) will I need
> to have 1gb of swap just to keep the VM happy?  Will 256 be enough?  Could I
> even live w/o swap?

Probably you'd live with 512MB of swap. As for w/o swap? You need it
atleast to hear the disks trashing and know you have to ctrl-c the damn
process, if not anything else.

I have:
spiral:~# free
             total       used       free     shared    buffers     cached
Mem:        254572      89936     164636          0       4352      48016
-/+ buffers/cache:      37568     217004
Swap:       530136          0     530136

With X, netscape and a gcc running and doing quite fine.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 19:31     ` Dan Podeanu
@ 2001-06-17 19:33       ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2001-06-17 19:33 UTC (permalink / raw)
  To: linux-kernel

On Sun, Jun 17, 2001 at 10:31:47PM +0300, Dan Podeanu wrote:
> > Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one
> > needs that will always work.  However, in 2.2 for a 'workstation' one could
> > usually quite happily get away with having 128:128 and never have much of a
> > problem.  with 2.4.0 and up this isn't the case.  This has been the cause
> > of many people complaining quite loudly about 2.4 VM sucking and having
> > lots of OOM kills going about.  It's also been called an 'aritificial limit'
> > since one of the VM people had a patch to 'fix' this.  What I'm trying to
> > figure out is if this problem exists linearly or just with 'lower' ammounts
> > of total physical ram.  ie if I jump up to 512mb and don't have a webserver
> > or database (ie I've got 512mb so I end up with a big disk cache) will I need
> > to have 1gb of swap just to keep the VM happy?  Will 256 be enough?  Could I
> > even live w/o swap?
> 
> Probably you'd live with 512MB of swap.

Seeing as 256:256 seems to be doing fine on my other two machines, yes, it
might.  But since I'd repartition too (I hate swapfiles) I'd like to do it
once and be done with it.  I'd also like to know what exactly causes the
original problem (Like I said, my workload hasn't changed nor my programs
that much.  And w/ twice my swap I get the same swap usage I used to get
in 2.2/late 2.3..)

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-17 18:58 ` Jakob Østergaard
  2001-06-17 19:06   ` Tom Rini
@ 2001-06-17 21:43   ` alterity
  1 sibling, 0 replies; 14+ messages in thread
From: alterity @ 2001-06-17 21:43 UTC (permalink / raw)
  To: Jakob Østergaard; +Cc: linux-kernel

On Sun, 17 Jun 2001 20:58:35 +0200, you wrote:

>I have a database server with 1G phys and 1G swap. It uses 950+ MB for cache,
>as it should, and doesn't even *touch* swap.  This is 2.4.5.

I thought the new rule is: 
	total_memory = max(physical, swap);

And the old rule was:
	total_memory = physical + swap;

Hence under a 1G physical and 1G swap setup, the kernel would never
access swap. 

Is this the case, or am I a couple of megabytes short in my
understanding of things?




Al


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-19  7:36   ` Steve Kieu
@ 2001-06-19  8:13     ` Mike Galbraith
  0 siblings, 0 replies; 14+ messages in thread
From: Mike Galbraith @ 2001-06-19  8:13 UTC (permalink / raw)
  To: Steve Kieu; +Cc: kernel

On Tue, 19 Jun 2001, Steve Kieu wrote:

> Just an information for you to compare, now I am
> running the kernel compile from mandrake 80; version
> 2.4.3-20mdk on a
> machine Intel celeron 400Mhz 128M RAM, i810 graphic
> card (it will use some memory) ; runing together
> Star Office 5.2, Netscape 4.77, Mozilla (shiped with
> LM80), compiling alsa driver and you may guess how
> much swap it used?
>
> [sk@steve sk]$ free
>              total       used       free     shared
> buffers     cached
> Mem:        126108     124416       1692          0
>     604      51820
> -/+ buffers/cache:      71992      54116
> Swap:        72288          0      72288

Just a general note about swap preallocation:  I've done truckloads of
experimentation over the last year or so, and it is generally true that
kernels which have an active swapcache prior to need perform much better
than those which don't at crunch time.

It's also generally true that kernels which actually page very lightly
before crunchtime react sooner/better to crunch.  I hate to see swap
totally untouched because I then know full well that I have a bunch
of totally inactive but plugged up ram pages.  (If you have too much
ram, that doesn't matter :)

	-Mike


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-19  6:13   ` Rik van Riel
@ 2001-06-19  7:37     ` Mike Galbraith
  0 siblings, 0 replies; 14+ messages in thread
From: Mike Galbraith @ 2001-06-19  7:37 UTC (permalink / raw)
  To: Rik van Riel; +Cc: root, linux-kernel

On Tue, 19 Jun 2001, Rik van Riel wrote:

> On Tue, 19 Jun 2001, Mike Galbraith wrote:
> > On Mon, 18 Jun 2001, root wrote:
> >
> > > Regarding to the discussion on the swap size,
> > >
> > > Recently, Rick van Riel posted a message that there is a bug
> > > related to "reclaiming" the swap, and said that it is on his
> > > TODO list.
> >
> > That's fixed.
>
> It's not. We don't reclaim swap space when we run low on
> free swap space (by freeing up the space in swap of stuff
> which is in RAM).

Ah.. different problem.

	-Mike


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-19  5:30 ` Mike Galbraith
  2001-06-19  6:13   ` Rik van Riel
@ 2001-06-19  7:36   ` Steve Kieu
  2001-06-19  8:13     ` Mike Galbraith
  1 sibling, 1 reply; 14+ messages in thread
From: Steve Kieu @ 2001-06-19  7:36 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: kernel

Just an information for you to compare, now I am
running the kernel compile from mandrake 80; version
2.4.3-20mdk on a 
machine Intel celeron 400Mhz 128M RAM, i810 graphic
card (it will use some memory) ; runing together
Star Office 5.2, Netscape 4.77, Mozilla (shiped with
LM80), compiling alsa driver and you may guess how
much swap it used?

[sk@steve sk]$ free
             total       used       free     shared   
buffers     cached
Mem:        126108     124416       1692          0   
    604      51820
-/+ buffers/cache:      71992      54116
Swap:        72288          0      72288

Okay I dont have any other *bloated* software to run
and try to crash it :-)

The same situation when I ran 2.4.5-acx (try all with
13, 14, 15) swap usage is about 45Mb and it is
increasing by the time). After typing a while in
netscpae email form , netscape eats memory gradually
(or the kernel?) swap ran out and the machine went to
deadlock even without thrashing)

But now it is NOT increasing ( I am typing in yahoo
mail from netscape too) , the system is up for about 3
days.

Regards,


--- Mike Galbraith <mikeg@wen-online.de> wrote: > On
Mon, 18 Jun 2001, root wrote:
> 
> > Regarding to the discussion on the swap size,
> >
> > Recently, Rick van Riel posted a message that
> there is a bug
> > related to "reclaiming" the swap, and said that it
> is on his
> > TODO list.
> 
> That's fixed.
> 
> > If I believe it, the current trouble we have
> regarding to the swap
> > size is not because we do not have a sufficient
> size for the swap,
> > but because there is a bug, although Linus advised
> us to assign
> > 2 times the physical memory for the swap.
> 
> Please try 2.4.6.pre3.  (folks with various load
> types should do this
> and report results.. even if it generates a brief
> spurt of traffic).
> 
> 	-Mike
> 
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


=====
S.KIEU

_____________________________________________________________________________
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-19  5:30 ` Mike Galbraith
@ 2001-06-19  6:13   ` Rik van Riel
  2001-06-19  7:37     ` Mike Galbraith
  2001-06-19  7:36   ` Steve Kieu
  1 sibling, 1 reply; 14+ messages in thread
From: Rik van Riel @ 2001-06-19  6:13 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: root, linux-kernel

On Tue, 19 Jun 2001, Mike Galbraith wrote:
> On Mon, 18 Jun 2001, root wrote:
>
> > Regarding to the discussion on the swap size,
> >
> > Recently, Rick van Riel posted a message that there is a bug
> > related to "reclaiming" the swap, and said that it is on his
> > TODO list.
>
> That's fixed.

It's not. We don't reclaim swap space when we run low on
free swap space (by freeing up the space in swap of stuff
which is in RAM).

regards,

Rik
--
Executive summary of a recent Microsoft press release:
   "we are concerned about the GNU General Public License (GPL)"


		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com/


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
  2001-06-18 11:21 root
@ 2001-06-19  5:30 ` Mike Galbraith
  2001-06-19  6:13   ` Rik van Riel
  2001-06-19  7:36   ` Steve Kieu
  0 siblings, 2 replies; 14+ messages in thread
From: Mike Galbraith @ 2001-06-19  5:30 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

On Mon, 18 Jun 2001, root wrote:

> Regarding to the discussion on the swap size,
>
> Recently, Rick van Riel posted a message that there is a bug
> related to "reclaiming" the swap, and said that it is on his
> TODO list.

That's fixed.

> If I believe it, the current trouble we have regarding to the swap
> size is not because we do not have a sufficient size for the swap,
> but because there is a bug, although Linus advised us to assign
> 2 times the physical memory for the swap.

Please try 2.4.6.pre3.  (folks with various load types should do this
and report results.. even if it generates a brief spurt of traffic).

	-Mike


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: 2.4 VM & swap question
@ 2001-06-18 11:21 root
  2001-06-19  5:30 ` Mike Galbraith
  0 siblings, 1 reply; 14+ messages in thread
From: root @ 2001-06-18 11:21 UTC (permalink / raw)
  To: linux-kernel


Regarding to the discussion on the swap size,

Recently, Rick van Riel posted a message that there is a bug 
related to "reclaiming" the swap, and said that it is on his 
TODO list.

If I believe it, the current trouble we have regarding to the swap 
size is not because we do not have a sufficient size for the swap, 
but because there is a bug, although Linus advised us to assign
2 times the physical memory for the swap.

I don't know.

Anyway, I am trying to put an extra 4GB hard disk on an Alpha UP2000 right now.

Regards,

Hugh

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-06-19  8:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-17 17:48 2.4 VM & swap question Tom Rini
2001-06-17 18:58 ` Jakob Østergaard
2001-06-17 19:06   ` Tom Rini
2001-06-17 21:43   ` alterity
2001-06-17 19:12 ` Dan Podeanu
2001-06-17 19:20   ` Tom Rini
2001-06-17 19:31     ` Dan Podeanu
2001-06-17 19:33       ` Tom Rini
2001-06-18 11:21 root
2001-06-19  5:30 ` Mike Galbraith
2001-06-19  6:13   ` Rik van Riel
2001-06-19  7:37     ` Mike Galbraith
2001-06-19  7:36   ` Steve Kieu
2001-06-19  8:13     ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).