lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <48EB3B44.3030202@miraclelinux.com>
Date:	Tue, 07 Oct 2008 19:34:44 +0900
From:	Naohiro Ooiwa <nooiwa@...aclelinux.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] oom_kill: fix calculation of the cpu_time and the run_time

Hi all

The cpu-time is in tens of seconds
and the run-time is in thousands of secounds.

but the source code doesn't follow it.

I fixed it and also some white-spaces.
Could you please check this patch.


Signed-off-by: Naohiro Ooiwa <nooiwa@...aclelinux.com>
---
 mm/oom_kill.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 64e5b4b..bddab74 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -100,14 +100,14 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)

 	/*
 	 * CPU time is in tens of seconds and run time is in thousands
-         * of seconds. There is no particular reason for this other than
-         * that it turned out to work very well in practice.
+	 * of seconds. There is no particular reason for this other than
+	 * that it turned out to work very well in practice.
 	 */
-	cpu_time = (cputime_to_jiffies(p->utime) + cputime_to_jiffies(p->stime))
-		>> (SHIFT_HZ + 3);
+	cpu_time = ((cputime_to_jiffies(p->utime) + cputime_to_jiffies(p->stime))
+		>> SHIFT_HZ) / 10UL;

 	if (uptime >= p->start_time.tv_sec)
-		run_time = (uptime - p->start_time.tv_sec) >> 10;
+		run_time = (uptime - p->start_time.tv_sec) / 1000UL;
 	else
 		run_time = 0;

-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ