Re: [RFC][PATCH] oom_kill: avoid depends on total_vm and use realRSS/swap value for oom_score (Re: Memory overcommit

From: KAMEZAWA Hiroyuki
Date: Tue Oct 27 2009 - 03:59:06 EST


On Tue, 27 Oct 2009 16:45:26 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
/*
> * After this unlock we can no longer dereference local variable `mm'
> @@ -92,8 +93,13 @@ unsigned long badness(struct task_struct
> */
> list_for_each_entry(child, &p->children, sibling) {
> task_lock(child);
> - if (child->mm != mm && child->mm)
> - points += child->mm->total_vm/2 + 1;
> + if (child->mm != mm && child->mm) {
> + unsigned long cpoint;
> + /* At considering child, we don't count swap */
> + cpoint = get_mm_counter(child->mm, anon_rss) +
> + get_mm_counter(child->mm, file_rss);
> + points += cpoint/2 + 1;
> + }
> task_unlock(child);

BTW, I'd like to get rid of this code.

Can't we use other techniques for detecting fork-bomb ?

This check can't catch following type, anyway.

fork()
-> fork()
-> fork()
-> fork()
....

but I have no good idea.
What is the difference with task-launcher and fork bomb()...

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/