diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2010-08-09 20:19:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:45:01 -0400 |
commit | 26ebc984913b6a8d86d724b3a79d2ed4ed574612 (patch) | |
tree | 9d293c6f8b1bc5120beaa173590dcd83cd0e2eb0 /fs/proc | |
parent | f88ccad5886d5a864b8b0d48c666ee9998dec53f (diff) |
oom: /proc/<pid>/oom_score treat kernel thread honestly
If a kernel thread is using use_mm(), badness() returns a positive value.
This is not a big issue because caller take care of it correctly. But
there is one exception, /proc/<pid>/oom_score calls badness() directly and
doesn't care that the task is a regular process.
Another example, /proc/1/oom_score return !0 value. But it's unkillable.
This incorrectness makes administration a little confusing.
This patch fixes it.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index acb7ef80ea4f..fc23f62bb0b8 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -428,7 +428,8 @@ static const struct file_operations proc_lstats_operations = { | |||
428 | #endif | 428 | #endif |
429 | 429 | ||
430 | /* The badness from the OOM killer */ | 430 | /* The badness from the OOM killer */ |
431 | unsigned long badness(struct task_struct *p, unsigned long uptime); | 431 | unsigned long badness(struct task_struct *p, struct mem_cgroup *mem, |
432 | nodemask_t *nodemask, unsigned long uptime); | ||
432 | static int proc_oom_score(struct task_struct *task, char *buffer) | 433 | static int proc_oom_score(struct task_struct *task, char *buffer) |
433 | { | 434 | { |
434 | unsigned long points = 0; | 435 | unsigned long points = 0; |
@@ -437,7 +438,7 @@ static int proc_oom_score(struct task_struct *task, char *buffer) | |||
437 | do_posix_clock_monotonic_gettime(&uptime); | 438 | do_posix_clock_monotonic_gettime(&uptime); |
438 | read_lock(&tasklist_lock); | 439 | read_lock(&tasklist_lock); |
439 | if (pid_alive(task)) | 440 | if (pid_alive(task)) |
440 | points = badness(task, uptime.tv_sec); | 441 | points = badness(task, NULL, NULL, uptime.tv_sec); |
441 | read_unlock(&tasklist_lock); | 442 | read_unlock(&tasklist_lock); |
442 | return sprintf(buffer, "%lu\n", points); | 443 | return sprintf(buffer, "%lu\n", points); |
443 | } | 444 | } |