Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
(Nearly) full tickless operation in 3.10
There are certain obscure programs like firefox and gimp that have very large caches which
could be dumped under pressure.
Avoiding swap IO with mem_notify
Posted Feb 2, 2008 17:49 UTC (Sat) by riel (subscriber, #3142)
The patch series is indeed designed primarily to increase system performance by avoiding the
IO penalty of swapping out (and back in) memory that contains data that is useless or can be
Decompressing (part of) a jpeg just has to be faster than swapping in something from disk,
simply because disk seek times are on the order of 10ms.
Avoiding the OOM killer is a secondary goal. I am not sure why that is the headline of the
Posted Feb 3, 2008 4:14 UTC (Sun) by njs (guest, #40338)
Oh! This makes *much* more sense. (Especially the otherwise unintelligible part of the
original article that talks about pages getting swapped out, which has nothing to do with
In fairness, though, the LKML patch announcement just talks about it being good to avoid the
Posted Feb 3, 2008 21:02 UTC (Sun) by oak (subscriber, #2786)
The article talks also about embedded systems. Those use use flash which
doesn't suffer from the seek problem like hard disks do. On embedded
memory usage is much more of a problem though and kernel gets pretty slow
too on devices without swap when memory gets really tight (all kernel does
is page read-only pages from disk to memory and then discard them again
until it finally does an OOM-kill).
I thought the point of the patch is for user-space to be able to do the
memory management in *manageable places* in code. As mentioned earlier,
a lot of user-space code doesn't handle memory allocation failures. And
even if it's supposed to be, it can be hard to verify (test) that the
failures are handled in *all* cases properly. If user-space can get a
pre-notification of a low-memory situation, it can in suitable place in
code free memory so that further allocations will succeed (with higher
That also allows doing somehing like what maemo does. If system gets
notified about kernel low memory shortage, it kills processes which have
notified it that they are in "background-killable" state (saved their UI
state, able to restore it and not currently visible to user). I think it
also notifies applications (currently) through D-BUS about low memory
condition. Applications visible to user or otherwise non-background
killable are then supposed to free their caches and/or disable features
that could take a lot of additional memory. If the caches are from heap
instead of memory mapped, it's less likely to help because of heap
fragmentation and it requiring more work/time though.
 Glib and anything built on top of it, like Gtk, assume that if process
is still running, it got the memory, otherwise it's aborted.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds