linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* swap and 2.4.20
@ 2003-10-05 11:57 Hacksaw
  2003-10-05 12:25 ` John Bradford
  2003-10-05 14:05 ` Maciej Zenczykowski
  0 siblings, 2 replies; 11+ messages in thread
From: Hacksaw @ 2003-10-05 11:57 UTC (permalink / raw)
  To: linux-kernel

I remember Linus ranting about swap at one point, but it's been a while.

What is the current state of the need for swap on a linux kernel, 2.4.20 in 
specific. Does it need *any*, given some reasonable amount of RAM? What 
constitutes a reasonable of RAM?

My recent experience suggest none is needed.


-- 
Silence is an invisible glue.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



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

* Re: swap and 2.4.20
  2003-10-05 11:57 swap and 2.4.20 Hacksaw
@ 2003-10-05 12:25 ` John Bradford
  2003-10-05 14:05 ` Maciej Zenczykowski
  1 sibling, 0 replies; 11+ messages in thread
From: John Bradford @ 2003-10-05 12:25 UTC (permalink / raw)
  To: Hacksaw, linux-kernel

Quote from Hacksaw <hacksaw@hacksaw.org>:

> What is the current state of the need for swap on a linux kernel, 2.4.20 in 
> specific. Does it need *any*, given some reasonable amount of RAM? What 
> constitutes a reasonable of RAM?

It depends almost entirely on your application.

> My recent experience suggest none is needed.

That's quite possible.

My 'standard' desktop machines run swapless with 512 MB RAM.

It is often said that adding too much swap does little or no harm, and
as disk space is cheap these days, it's better to over allocate it
rather than run out.

This is not always true.  Over-allocating swap space can degrade
performance and waste a lot of time in some cases.

For example,  I know an ISP who allocated more swap than needed on
their customer webserver.  Despite my advice, it wasn't reconfigured,
and one day a runaway process started using all the swap and the
machine became almost completely unresponsive.  Somebody spent hours
going to the datacentre and back just to reboot it.

John.

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

* Re: swap and 2.4.20
  2003-10-05 11:57 swap and 2.4.20 Hacksaw
  2003-10-05 12:25 ` John Bradford
@ 2003-10-05 14:05 ` Maciej Zenczykowski
  2003-10-05 18:01   ` Marcelo Tosatti
  2003-10-05 18:21   ` Bernd Eckenfels
  1 sibling, 2 replies; 11+ messages in thread
From: Maciej Zenczykowski @ 2003-10-05 14:05 UTC (permalink / raw)
  To: Linux Kernel Mailing List

> I remember Linus ranting about swap at one point, but it's been a while.
> 
> What is the current state of the need for swap on a linux kernel, 2.4.20 in 
> specific. Does it need *any*, given some reasonable amount of RAM? What 
> constitutes a reasonable of RAM?
> 
> My recent experience suggest none is needed.

I have a different - slightly academic - question.  Is it possible to turn
off swapping? (not turn off swap)  Ie. to prevent the kernel from
unloading paged-in read-only executables?  I realise this is a tough
question with mmap being used for many other things besides executables...

Thanks,
MaZe.


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

* Re: swap and 2.4.20
  2003-10-05 14:05 ` Maciej Zenczykowski
@ 2003-10-05 18:01   ` Marcelo Tosatti
  2003-10-05 18:21   ` Bernd Eckenfels
  1 sibling, 0 replies; 11+ messages in thread
From: Marcelo Tosatti @ 2003-10-05 18:01 UTC (permalink / raw)
  To: Maciej Zenczykowski; +Cc: Linux Kernel Mailing List



On Sun, 5 Oct 2003, Maciej Zenczykowski wrote:

> > I remember Linus ranting about swap at one point, but it's been a while.
> > 
> > What is the current state of the need for swap on a linux kernel, 2.4.20 in 
> > specific. Does it need *any*, given some reasonable amount of RAM? What 
> > constitutes a reasonable of RAM?
> > 
> > My recent experience suggest none is needed.
> 
> I have a different - slightly academic - question.  Is it possible to turn
> off swapping? (not turn off swap)  Ie. to prevent the kernel from
> unloading paged-in read-only executables?  I realise this is a tough
> question with mmap being used for many other things besides executables...

No. Paged-in clean pages might be removed from memory at any time and
reread upon access.



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

* Re: swap and 2.4.20
  2003-10-05 14:05 ` Maciej Zenczykowski
  2003-10-05 18:01   ` Marcelo Tosatti
@ 2003-10-05 18:21   ` Bernd Eckenfels
  2003-10-05 20:07     ` Hacksaw
  1 sibling, 1 reply; 11+ messages in thread
From: Bernd Eckenfels @ 2003-10-05 18:21 UTC (permalink / raw)
  To: linux-kernel

In article <Pine.LNX.4.44.0310051559340.5605-100000@gaia.cela.pl> you wrote:
> I have a different - slightly academic - question.  Is it possible to turn
> off swapping? (not turn off swap)  Ie. to prevent the kernel from
> unloading paged-in read-only executables?  I realise this is a tough
> question with mmap being used for many other things besides executables...

I think you mean paging? Read Only executable pages mapped to executables
will not be put/read from swap.

Greetings
Bernd
-- 
eckes privat - http://www.eckes.org/
Project Freefire - http://www.freefire.org/

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

* Re: swap and 2.4.20
  2003-10-05 18:21   ` Bernd Eckenfels
@ 2003-10-05 20:07     ` Hacksaw
  2003-10-05 21:56       ` Mike Fedyk
  0 siblings, 1 reply; 11+ messages in thread
From: Hacksaw @ 2003-10-05 20:07 UTC (permalink / raw)
  To: Bernd Eckenfels; +Cc: linux-kernel

So it's accurate to say that you can turn of swapping (by having no swap 
space), but you can't turn off paging.

One upshot of this is that the disk your root is on must be always available.

I have a real interest in this, because I have a consulting client who uses 
Linux on an embedded product. They were testing the product in a rough 
situation, and the CF card that they used to boot the system from came out of 
the slot. However, the machine kept running.

I would assume that since its programs were loaded, and it was unlikely to be 
starting new ones, it was just happily working, and would have until some 
random event would have caused it to try and do some paging. I assume that 
paging out wouldn't hurt anything, because that would just be flipping a bit 
in a table somewhere.

Does this mean that you could replace a library out from under a running but 
largely paged out app, and have it suddenly switch to the new library?
-- 
The audience is mother to the music.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



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

* Re: swap and 2.4.20
  2003-10-05 20:07     ` Hacksaw
@ 2003-10-05 21:56       ` Mike Fedyk
  2003-10-05 22:19         ` Hacksaw
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Fedyk @ 2003-10-05 21:56 UTC (permalink / raw)
  To: Hacksaw; +Cc: Bernd Eckenfels, linux-kernel

On Sun, Oct 05, 2003 at 04:07:33PM -0400, Hacksaw wrote:
> Does this mean that you could replace a library out from under a running but 
> largely paged out app, and have it suddenly switch to the new library?

Technically yes, but realistically no.

You'd more likely crash the app since maybe only a few pages of the new code
were paged in, and nothing says that it's the update of the code you wanted...

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

* Re: swap and 2.4.20
  2003-10-05 21:56       ` Mike Fedyk
@ 2003-10-05 22:19         ` Hacksaw
  2003-10-05 23:49           ` Mike Fedyk
  0 siblings, 1 reply; 11+ messages in thread
From: Hacksaw @ 2003-10-05 22:19 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: Bernd Eckenfels, linux-kernel

> > Does this mean that you could replace a library out from under a running but 
> > largely paged out app, and have it suddenly switch to the new library?
> 
> Technically yes, but realistically no.
> 
> You'd more likely crash the app since maybe only a few pages of the new code
> were paged in, and nothing says that it's the update of the code you wanted...
> 

Ahh, so nothing is done to ensure that that functional dependencies are 
resolved. All right, that's not shocking, since it's not the point.

In fact, thinking about what might be involved to make that possible hurts my 
head. Well maybe not. I wonder if you could have a mechanism that causes the 
entire library to be paged out and reloaded if while paging the version is 
discovered to have changed.

In many ways this would be cool, as it would mean that running apps could stay 
up and yet get bugs fixed.

I'm guessing that would require there to be no static variables in the 
library, as well as being fully reentrant, or that that any statics are in a 
page whose format doesn't change and is locked down for the switch.
-- 
Listening is a craft.
Hearing is an art.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



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

* Re: swap and 2.4.20
  2003-10-05 22:19         ` Hacksaw
@ 2003-10-05 23:49           ` Mike Fedyk
  2003-10-06  0:02             ` Hacksaw
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Fedyk @ 2003-10-05 23:49 UTC (permalink / raw)
  To: Hacksaw; +Cc: Bernd Eckenfels, linux-kernel

On Sun, Oct 05, 2003 at 06:19:26PM -0400, Hacksaw wrote:
> In fact, thinking about what might be involved to make that possible hurts my 
> head. Well maybe not. I wonder if you could have a mechanism that causes the 
> entire library to be paged out and reloaded if while paging the version is 
> discovered to have changed.
> 
> In many ways this would be cool, as it would mean that running apps could stay 
> up and yet get bugs fixed.
> 
> I'm guessing that would require there to be no static variables in the 
> library, as well as being fully reentrant, or that that any statics are in a 
> page whose format doesn't change and is locked down for the switch.

What you are talking about is equivalent to binary patching.

Now if your app could unload the library entirely, it could just reload the
updated copy.  But I really fail to see why the mechanism you are talking
about is needed.

If you have an app that needs to be available every second, then you need a
failover system, and why not just have three where you can take one down at
any time for updates(and still have one for failover during the update,
though you could get by with only two, and take down the fail-over machine
during the update)? 

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

* Re: swap and 2.4.20
  2003-10-05 23:49           ` Mike Fedyk
@ 2003-10-06  0:02             ` Hacksaw
  2003-10-06  2:05               ` Mike Fedyk
  0 siblings, 1 reply; 11+ messages in thread
From: Hacksaw @ 2003-10-06  0:02 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: linux-kernel

>What you are talking about is equivalent to binary patching.

Sure, just a bit safer.

>If you have an app that needs to be available every second, then you need a
>failover system, and why not just have three where you can take one down at
>any time for updates(and still have one for failover during the update,
>though you could get by with only two, and take down the fail-over machine
>during the update)? 

Well, the most obvious reason is that there is a unique state in the program 
that you wish to preserve. A possibly pathological scenario is this:

You have a machine controlling a physical process, say a robotic crane. It's 
currently holding up a big piece of work, and moving it the wrong way would be 
very bad.

You have just discovered that the movement routine fails to take some physical 
circumstance into account. If you could replace the routine in situ, there's 
no serious loss. However, stopping and restart the program is no good, because 
it automatically homes the crane, and more importantly, can't restart a 
movement routine in the middle.

A design failure? Sure, but a realistic scenario.


-- 
Signposts are useful when you know where you're going.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



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

* Re: swap and 2.4.20
  2003-10-06  0:02             ` Hacksaw
@ 2003-10-06  2:05               ` Mike Fedyk
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Fedyk @ 2003-10-06  2:05 UTC (permalink / raw)
  To: Hacksaw; +Cc: linux-kernel

On Sun, Oct 05, 2003 at 08:02:21PM -0400, Hacksaw wrote:
> You have a machine controlling a physical process, say a robotic crane. It's 
> currently holding up a big piece of work, and moving it the wrong way would be 
> very bad.

Heh, if I knew the software was being upgraded, and I was anywhere near it,
I'd run for dear life... ;)

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

end of thread, other threads:[~2003-10-06  2:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-05 11:57 swap and 2.4.20 Hacksaw
2003-10-05 12:25 ` John Bradford
2003-10-05 14:05 ` Maciej Zenczykowski
2003-10-05 18:01   ` Marcelo Tosatti
2003-10-05 18:21   ` Bernd Eckenfels
2003-10-05 20:07     ` Hacksaw
2003-10-05 21:56       ` Mike Fedyk
2003-10-05 22:19         ` Hacksaw
2003-10-05 23:49           ` Mike Fedyk
2003-10-06  0:02             ` Hacksaw
2003-10-06  2:05               ` Mike Fedyk

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).