[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191115101831.GW5671@hirez.programming.kicks-ass.net>
Date: Fri, 15 Nov 2019 11:18:31 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Wanpeng Li <wanpengli@...cent.com>,
Pavel Machek <pavel@....cz>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Thomas Gleixner <tglx@...utronix.de>,
Yauheni Kaliuta <yauheni.kaliuta@...hat.com>,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Viresh Kumar <viresh.kumar@...aro.org>,
Rik van Riel <riel@...riel.com>
Subject: Re: [PATCH 3/9] sched/vtime: Handle nice updates under vtime
On Fri, Nov 15, 2019 at 11:16:48AM +0100, Peter Zijlstra wrote:
> On Wed, Nov 06, 2019 at 04:08:01AM +0100, Frederic Weisbecker wrote:
> > The cputime niceness is determined while checking the target's nice value
> > at cputime accounting time. Under vtime this happens on context switches,
> > user exit and guest exit. But nice value updates while the target is
> > running are not taken into account.
> >
> > So if a task runs tickless for 10 seconds in userspace but it has been
> > reniced after 5 seconds from -1 (not nice) to 1 (nice), on user exit
> > vtime will account the whole 10 seconds as CPUTIME_NICE because it only
> > sees the latest nice value at accounting time which is 1 here. Yet it's
> > wrong, 5 seconds should be accounted as CPUTIME_USER and 5 seconds as
> > CPUTIME_NICE.
> >
> > In order to solve this, we now cover nice updates withing three cases:
> >
> > * If the nice updater is the current task, although we are in kernel
> > mode there can be pending user or guest time in the cache to flush
> > under the prior nice state. Account these if any. Also toggle the
> > vtime nice flag for further user/guest cputime accounting.
> >
> > * If the target runs on a different CPU, we interrupt it with an IPI to
> > update the vtime state in place. If the task is running in user or
> > guest, the pending cputime is accounted under the prior nice state.
> > Then the vtime nice flag is toggled for further user/guest cputime
> > accounting.
>
> But but but, I thought the idea was to _never_ send interrupts to
> NOHZ_FULL cpus ?!?
That is, isn't the cure worse than the problem? I mean, who bloody cares
about silly accounting crud more than not getting interrupts on their
NOHZ_FULL cpus.
Powered by blists - more mailing lists