[lkml]   [2019]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/9] sched/vtime: Handle nice updates under vtime
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
> 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 ?!?

 \ /
  Last update: 2019-11-15 11:18    [W:0.085 / U:13.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site