提交 a12888f7 编写于 作者: C Cyrill Gorcunov 提交者: Linus Torvalds

oom_kill: don't call for int_sqrt(0)

There is no need to call for int_sqrt if argument is 0.
Signed-off-by: NCyrill Gorcunov <gorcunov@openvz.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>
Acked-by: NDavid Rientjes <rientjes@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d086817d
...@@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(zone_scan_lock); ...@@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(zone_scan_lock);
unsigned long badness(struct task_struct *p, unsigned long uptime) unsigned long badness(struct task_struct *p, unsigned long uptime)
{ {
unsigned long points, cpu_time, run_time, s; unsigned long points, cpu_time, run_time;
struct mm_struct *mm; struct mm_struct *mm;
struct task_struct *child; struct task_struct *child;
...@@ -110,12 +110,10 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) ...@@ -110,12 +110,10 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
else else
run_time = 0; run_time = 0;
s = int_sqrt(cpu_time); if (cpu_time)
if (s) points /= int_sqrt(cpu_time);
points /= s; if (run_time)
s = int_sqrt(int_sqrt(run_time)); points /= int_sqrt(int_sqrt(run_time));
if (s)
points /= s;
/* /*
* Niced processes are most likely less important, so double * Niced processes are most likely less important, so double
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册