--- mm/oom_kill.c.orig 2007-08-01 10:41:53.000000000 -0700 +++ mm/oom_kill.c 2008-02-04 14:47:10.000000000 -0800 @@ -83,11 +83,14 @@ * machine with an endless amount of children. In case a single * child is eating the vast majority of memory, adding only half * to the parents will make the child our kill candidate of choice. + * When counting the children's vmsize against the parent, we + * subtract shared_vm first, to avoid overcounting memory that is + * shared among the child processes and the parent. */ list_for_each_entry(child, &p->children, sibling) { task_lock(child); if (child->mm != mm && child->mm) - points += child->mm->total_vm/2 + 1; + points += (child->mm->total_vm - child->mm->shared_vm)/2 + 1; task_unlock(child); }