mm, oom: fix and cleanup oom score calculations
authorDavid Rientjes <rientjes@google.com>
Wed, 20 Jun 2012 19:52:58 +0000 (12:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 20 Jun 2012 21:39:35 +0000 (14:39 -0700)
commit61eafb00d55dfbccdfce543c6b60e369ff4f8f18
treee2be309a7412de35dd8414ea030b6650d2ea8b75
parentfbb24a3a915f105016f1c828476be11aceac8504
mm, oom: fix and cleanup oom score calculations

The divide in p->signal->oom_score_adj * totalpages / 1000 within
oom_badness() was causing an overflow of the signed long data type.

This adds both the root bias and p->signal->oom_score_adj before doing the
normalization which fixes the issue and also cleans up the calculation.

Tested-by: Dave Jones <davej@redhat.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/oom_kill.c