[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1603051121550.3686@nanos>
Date: Sat, 5 Mar 2016 11:27:01 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Chris Friesen <cbf123@...l.usask.ca>
cc: John Stultz <john.stultz@...aro.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Frederic Weisbecker <fweisbec@...il.com>,
lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] steal_account_process_tick() should return jiffies
Chris,
On Fri, 4 Mar 2016, Chris Friesen wrote:
First of all the subject line should contain a subsystem prefix,
i.e. "sched/cputime:"
> The callers of steal_account_process_tick() expect it to return whether
> the last jiffy was stolen or not.
>
> Currently the return value of steal_account_process_tick() is in units
> of cputime, which vary between either jiffies or nsecs depending on
> CONFIG_VIRT_CPU_ACCOUNTING_GEN.
Sure, but what is the actual problem? The return value is boolean and tells
whether there was stolen time accounted or not.
> The fix is to change steal_account_process_tick() to always return
> jiffies. If CONFIG_VIRT_CPU_ACCOUNTING_GEN is not enabled then this
> is a no-op.
What does that fix?
> As far as I can tell this bug has been present since commit dee08a72.
Which bug?
> Signed-off-by: Chris Friesen <chris.friesen@...driver.com>
> ---
>
> kernel/sched/cputime.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
> index b2ab2ff..e724496 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -276,7 +276,7 @@ static __always_inline bool steal_account_process_tick(void)
> this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct);
>
> account_steal_time(steal_ct);
> - return steal_ct;
> + return cputime_to_jiffies(steal_ct);
So if steal time is close to a jiffie, then cputime_to_jiffies will return 0
and you account a full jiffie to user/system/whatever.
Without a proper explanation of the problem and the resulting "bug" I really
cannot figure out why we want that change.
Thanks,
tglx
Powered by blists - more mailing lists