Re: Magic in swap code. :-)

Stephane Casset (sept@renass3.u-strasbg.fr)
Tue, 31 Mar 1998 12:00:06 +0000 (GMT)


On Mon, 30 Mar 1998, Rik van Riel wrote:

> Date: Mon, 30 Mar 1998 16:50:36 +0200 (MET DST)
> From: Rik van Riel <H.H.vanRiel@fys.ruu.nl>
> To: Chirayu Patel <chirayu@wipro.tcpn.com>
> Cc: Kernel Mailing List <linux-kernel@vger.rutgers.edu>,
> Rik van Riel <H.H.vanRiel@fys.ruu.nl>,
> "Dr. Werner Fink" <werner@suse.de>,
> "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>,
> "Benjamin C.R. LaHaise" <blah@kvack.org>
> Subject: Re: Magic in swap code. :-)

Hi,

I am not a kernel hacker but a read carefully this thread about swap
performence...
And I have a idea, don't know if it is good or bad so here it is as is :

Lets implement a state of kswap where it tries to pre-swap a page,
to pre-swap a page is just put it on disk mark it in the page structure
as being on disk but KEEP it in memory.

So after a while most of the main memory should be pre-swapped ie on disk.
When the system needs memory : just go through the page structure and
free pages according to whatever algo you want and swap it out,
as pages are already on disk you just need to mark in NOT IN MEMORY
and that's all.
Of course you have to be sure that the page pre-swapped is really the
same as the page in memory... (maybe this is the hard part)
If you access a pre-swapped page in write mode mark it as DIFFERENT from
the pre-swapped image and free the pre-swapped image.
This way kswap should to most of its disk activity when the system is idle
and keep the maximum of pages in memory but ready to be freed...

Does it sound stupid ? Comments ? Flames ?

just my $0.02 ;)

Stephane
***************************************************************
-----/ | << L'essentiel est invisible a l'oeil,
/ | on ne voit bien qu'avec le coeur. >>
/ | St. Exupery
/ | Stephane Casset : sept@renass3.u-strasbg.fr,
/ | casset@inforezo.u-strasbg.fr
/ | http://inforezo.u-strasbg.fr/~casset
***************************************************************

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu