RE: [PATCH] mm, oom: normalize the adj to ensure oom_badness return a positive number

From: David Rientjes
Date: Tue Mar 04 2014 - 17:05:54 EST


On Tue, 4 Mar 2014, He, Bo wrote:

> Sorry, the title is confusing. Change it to: mm, oom: normalize the adj to ensure oom_badness returns a positive number

There's something seriously wrong with your email client, it's not
replying correctly to threads so this appears as a completely new thread.
Meanwhile, your patch was completely whitespace damaged. Please read
Documentation/email-clients.txt.

> We are enabling android mobiles. When running stress memory test, there is a bad issue. Some critical processes such as Healthd and watchdogd are killed, while some other processes are still alive.
> OOM should kill the tasks whose oom_score are biggest. Many processes use a minus oom_score_adj. oom_badness returns 1 for all of them and their oom_score are all 0.
>

No, you're confusing two different things. A negative
/proc/pid/oom_score_adj discounts a process's memory usage in comparison
to other processes. If this value discounts all memory usage for every
process, then your setting of /proc/pid/oom_score_adj is wrong.

oom_badness() returns 1 so that the oom killer may still kill these
processes, the /proc/pid/oom_score is irrelevant to this (and the only
reason it appears as 0 is because it already normalizes by multiplying by
1000 / totalpages).

> The patch tries to convert the minus oom_score_adj to a positive number when calculating oom_score. oom_score can keep right process priority sequence.
>

Nack, this patch is completely disregarding the value specified by the
user for /proc/pid/oom_score_adj. Your userspace should be using
/proc/pid/oom_score_adj, not /proc/pid/oom_adj.
--
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/