No surprise on memory

Carol Farlow Lerche cafl at
Thu Dec 18 13:12:07 EST 2008

While the MTD layer does go to memory first, my thought about two swaps was
slightly different.  Depending on how they are managed, one of two things
might happen:  (I assume the second swap isn't used until the first is full)
1. less "busy" stuff gets migrated to the second swap or 2) The second swap
just gets the latest thing that needs swapping even if it is busy.  (1)
would be better if the second swap is on flash to minimize wear ... this is
like old time hierarchical storage management on mainframes.  Yes I did roam
the earth with the dinosaurs.  (2) would potentially allow for a graceful
OOM management by using something about  second swap usage to be a signal to
make the user pick an activity to close.

On Thu, Dec 18, 2008 at 9:55 AM, Martin Langhoff
<martin.langhoff at>wrote:

> On Thu, Dec 18, 2008 at 1:43 PM, Carol Farlow Lerche <cafl at>
> wrote:
> > Since Linux allows multiple swap partitions, is there anything to be
> gained
> > by using two -- the first, a compcache swap file and the second on flash,
> > perhaps with Belyakov's MTD layer.  First question is whether Linux
> treats
> > the two swap files in an order, such that it only uses the flash swap if
> the
> > compcache is exhausted.  If so, instrument the I/O rate to swap, first to
> > study the relative sizing and second -- could the I/O rate to the flash
> swap
> > be a signal to prune activities?
> Both Belyakov and Richard Purdie seem to compress into a large-ish
> buffer in RAM first, and only past a certain threshold actually put it
> to NAND. This is to minimise number of erase ops, and improve
> performance, so the swaponflash driver Richard's posted does exactly
> what you describe.
> As to treating that as a signal, I dunno.
> I do think Sugar could monitor some mem stats and warn the user
> _early_ when under mem pressure. If more than one activity is open, it
> could sugges to close a bg activity...
> cheers,
> m
> --
>  martin.langhoff at
>  martin at -- School Server Architect
>  - ask interesting questions
>  - don't get distracted with shiny stuff  - working code first
>  -

"Don't think for a minute that power concedes. We have to work like our
future depends on it."  -- Barack Obama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Devel mailing list