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.<br>
<br><div class="gmail_quote">On Thu, Dec 18, 2008 at 9:55 AM, Martin Langhoff <span dir="ltr"><<a href="mailto:martin.langhoff@gmail.com">martin.langhoff@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Thu, Dec 18, 2008 at 1:43 PM, Carol Farlow Lerche <<a href="mailto:cafl@msbit.com">cafl@msbit.com</a>> wrote:<br>
> Since Linux allows multiple swap partitions, is there anything to be gained<br>
> by using two -- the first, a compcache swap file and the second on flash,<br>
> perhaps with Belyakov's MTD layer.  First question is whether Linux treats<br>
> the two swap files in an order, such that it only uses the flash swap if the<br>
> compcache is exhausted.  If so, instrument the I/O rate to swap, first to<br>
> study the relative sizing and second -- could the I/O rate to the flash swap<br>
> be a signal to prune activities?<br>
<br>
</div>Both Belyakov and Richard Purdie seem to compress into a large-ish<br>
buffer in RAM first, and only past a certain threshold actually put it<br>
to NAND. This is to minimise number of erase ops, and improve<br>
performance, so the swaponflash driver Richard's posted does exactly<br>
what you describe.<br>
<br>
As to treating that as a signal, I dunno.<br>
<br>
I do think Sugar could monitor some mem stats and warn the user<br>
_early_ when under mem pressure. If more than one activity is open, it<br>
could sugges to close a bg activity...<br>
<br>
cheers,<br>
<br>
<br>
<br>
m<br>
<font color="#888888">--<br>
</font><div><div></div><div class="Wj3C7c"> <a href="mailto:martin.langhoff@gmail.com">martin.langhoff@gmail.com</a><br>
 <a href="mailto:martin@laptop.org">martin@laptop.org</a> -- School Server Architect<br>
 - ask interesting questions<br>
 - don't get distracted with shiny stuff  - working code first<br>
 - <a href="http://wiki.laptop.org/go/User:Martinlanghoff" target="_blank">http://wiki.laptop.org/go/User:Martinlanghoff</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>"Don't think for a minute that power concedes. We have to work like our future depends on it."  -- Barack Obama<br>