LKML Archive on
help / color / mirror / Atom feed
* oom_kill.c badness() correction for shared memory
@ 2007-02-09 18:34 Jeff Davis
  0 siblings, 0 replies; only message in thread
From: Jeff Davis @ 2007-02-09 18:34 UTC (permalink / raw)
  To: linux-kernel

In oom_kill.c, badness() takes into account many factors, including half
the total_vm of all the children.

The problem with this calculation is that, if the parent and children
share memory, the shared memory segment is counted many times for the

I don't think we need to count the shared memory at all when calculating
badness, because there's already a hard limit on the amount of shared
memory, so it's unlikely that process is runaway due to shared memory

Would it be better to just use (total_vm-shared_vm) in the badness
function in each instance it currently uses total_vm? At a minimum, we
should do that for the loop that counts each child's vm against the

An example of a practical problem is with PostgreSQL. PostgreSQL
installations often have very large shared memory regions shared between
the parent and all the child processes. If the OOM killer is invoked,
it's almost guaranteed to kill the PostgreSQL parent process first, even
if the PostgreSQL processes all combined use much less memory than the
"real" bad process (because the same shared memory is counted many

	Jeff Davis

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-09 19:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 18:34 oom_kill.c badness() correction for shared memory Jeff Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).