diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2011-04-27 18:26:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-28 14:28:21 -0400 |
commit | f755a042d82b51b54f3bdd0890e5ea56c0fb6807 (patch) | |
tree | 15c51ff44a31c4686dbc7161184ef7f306010e0c /mm/oom_kill.c | |
parent | 0dcecae203cd407678e7257efbc9cdd0130967cf (diff) |
oom: use pte pages in OOM score
PTE pages eat up memory just like anything else, but we do not account for
them in any way in the OOM scores. They are also _guaranteed_ to get
freed up when a process is OOM killed, while RSS is not.
Reported-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: <stable@kernel.org> [2.6.36+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 83fb72c108b7..f52e85c80e8d 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -172,10 +172,13 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | |||
172 | 172 | ||
173 | /* | 173 | /* |
174 | * The baseline for the badness score is the proportion of RAM that each | 174 | * The baseline for the badness score is the proportion of RAM that each |
175 | * task's rss and swap space use. | 175 | * task's rss, pagetable and swap space use. |
176 | */ | 176 | */ |
177 | points = (get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS)) * 1000 / | 177 | points = get_mm_rss(p->mm) + p->mm->nr_ptes; |
178 | totalpages; | 178 | points += get_mm_counter(p->mm, MM_SWAPENTS); |
179 | |||
180 | points *= 1000; | ||
181 | points /= totalpages; | ||
179 | task_unlock(p); | 182 | task_unlock(p); |
180 | 183 | ||
181 | /* | 184 | /* |