mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Naohiro Ooiwa <nooiwa@miraclelinux.com>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] oom_kill: fix calculation of the cpu_time and the run_time
Date: Tue,  7 Oct 2008 20:15:46 +0900 (JST)	[thread overview]
Message-ID: <20081007201309.5A71.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <48EB3B44.3030202@miraclelinux.com>

> 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.

Have you seen any trouble?

> 
> I fixed it and also some white-spaces.
> Could you please check this patch.
> 
> 
> Signed-off-by: Naohiro Ooiwa <nooiwa@miraclelinux.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;

in some architecture, shift-op outperfom divide-op largely.
why do you need this change?




  reply	other threads:[~2008-10-07 11:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 10:34 Naohiro Ooiwa
2008-10-07 11:15 ` KOSAKI Motohiro [this message]
2008-10-07 16:14   ` Naohiro Ooiwa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081007201309.5A71.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nooiwa@miraclelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®