[PATCH] oom_kill -- don't call for int_sqrt(0)

From: Cyrill Gorcunov
Date: Tue Jan 13 2009 - 09:38:50 EST


There is no need to call for int_sqrt if argument is 0.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
---

Please review.

mm/oom_kill.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6.git/mm/oom_kill.c
===================================================================
--- linux-2.6.git.orig/mm/oom_kill.c
+++ linux-2.6.git/mm/oom_kill.c
@@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(zone_scan_lock);

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 task_struct *child;

@@ -110,12 +110,10 @@ unsigned long badness(struct task_struct
else
run_time = 0;

- s = int_sqrt(cpu_time);
- if (s)
- points /= s;
- s = int_sqrt(int_sqrt(run_time));
- if (s)
- points /= s;
+ if (cpu_time)
+ points /= int_sqrt(cpu_time);
+ if (run_time)
+ points /= int_sqrt(int_sqrt(run_time));

/*
* Niced processes are most likely less important, so double
--
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/