lkml.org 
[lkml]   [2018]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 20/25] sched/kcpustat: Introduce vtime-aware kcpustat accessor
On Tue, Nov 20, 2018 at 03:23:06PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 14, 2018 at 03:46:04AM +0100, Frederic Weisbecker wrote:
>
> > +void kcpustat_cputime(struct kernel_cpustat *kcpustat, int cpu,
> > + u64 *user, u64 *nice, u64 *system,
> > + u64 *guest, u64 *guest_nice)
> > +{
> > + struct task_struct *curr;
> > + struct vtime *vtime;
> > + int err;
> > +
> > + if (!vtime_accounting_enabled()) {
> > + kcpustat_cputime_raw(kcpustat, user, nice,
> > + system, guest, guest_nice);
> > + return;
> > + }
> > +
> > + rcu_read_lock();
> > +
> > + do {
> > + curr = rcu_dereference(kcpustat->curr);
>
> Like I explained earlier; I don't think the above is correct.
> task_struct is itself not RCU protected.

But there is at least one put_task_struct() that is enqueued as an RCU callback
on release_task(). That patchset (try to) make sure that kcpustat->curr can't
be assigned beyond that point.

Or did I misunderstand something?

\
 
 \ /
  Last update: 2018-11-20 23:41    [W:0.135 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site