lkml.org 
[lkml]   [2023]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] tick/nohz: fix data races in get_cpu_idle_time_us()
On Tue, Jan 31, 2023 at 08:57:59PM +0100, Peter Zijlstra wrote:
> On Tue, Jan 31, 2023 at 03:44:00PM +0100, Thomas Gleixner wrote:
>
> > P.S.: I hate the spinlock in the idle code path, but I don't have a
> > better idea.
>
> seqcount? It would avoid the obvious interleave and put most of the onus
> on the reader (which never happens anyway).

Yep, and do the update locally only on idle exit. But note that neither
seqcount nor spinlock will fix the nr_iowait_cpu() based thing. This counter
can be decremented remotely even during the idle period so the reader
can see an iowait period that may eventually be accounted as !iowait,
or the reverse. Breaking the monotonicity and even coherency.

That stuff is broken by design and this is the reason why it got never
really fixed. The seqcount/spinlock would make it just a bit less worse.

\
 
 \ /
  Last update: 2023-03-27 00:04    [W:2.149 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site