Re: dynamic swapspace

David Ford (david@kalifornia.com)
Tue, 28 Sep 1999 22:02:16 -0100


Robbert Muller wrote:

> On Sat, 25 Sep 1999, Enrico Weigelt wrote:
>
> > i want to write an dynamic swap manager (allocate swapspace when
> > needed).
>
> mmm smells like windows to me ;-)

sounds like efficiency.

> > * let the memory allocation functions block processes which request more
> > memory than the free amount.
> oke swap let seee this situation
>
> swap deamon needs memory, but there is not enough memory so swap deamon
> get blokked. Next there will me no memory so other precesses get locked
> to. finaly all processes get bloked and no process responce anymore.

nope. swap daemon locks pages on init, doesn't get swapped out so doesn't
block. the swap daemon shouldn't grow in size in the first place. should
something happen that consumes all available memory, the OOM handler exists
to free memory. reboot not required.

> so a reboot is needed ( magic sysrq )
>
> > * add a process flag which tells the memory allocation functions by
> > bypass
> > the new mechanism - for critical processes like the swap deamon itself.
>
> but there is no memory so the swapdeamon crashes and the fuction will not
> work anymore

just because there is no more memory doesn't mean a program should crash. if
this is the way you write code, i recommend a moment of thought.

with just a minor bit of thought, memory paging control and disk ops can be
handled sweetly and succintly without problems. and there's a beautiful
-ENOMEM type of return when you really can't get any more memory.

-d

--
 This is Linux Country. On a quiet night, you can hear Windows NT reboot!
  Do you remember how to -think- ? Do you remember how to experiment? Linux
__ is an operating system that brings back the fun and adventure in computing.
\/  for linux-kernel: please read linux/Documentation/* before posting problems

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/