lkml.org 
[lkml]   [2010]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] avoid using smp_processor_id() in preemptible code (nr_iowait_cpu)
On (06/15/10 07:24), Arjan van de Ven wrote:
> On Tue, 15 Jun 2010 09:19:27 +0300
> Sergey Senozhatsky <sergey.senozhatsky@gmail.com> wrote:
> > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> > index 1d7b9bc..101e8aa 100644
> > --- a/kernel/time/tick-sched.c
> > +++ b/kernel/time/tick-sched.c
> > @@ -159,10 +159,12 @@ update_ts_time_stats(struct tick_sched *ts,
> > ktime_t now, u64 *last_update_time) ktime_t delta;
> >
> > if (ts->idle_active) {
> > + int cpu = get_cpu();
> > delta = ktime_sub(now, ts->idle_entrytime);
> > ts->idle_sleeptime = ktime_add(ts->idle_sleeptime,
> > delta);
> > - if (nr_iowait_cpu() > 0)
> > + if (nr_iowait_cpu(cpu) > 0)
> > ts->iowait_sleeptime =
> > ktime_add(ts->iowait_sleeptime, delta);
> > + put_cpu();
> > ts->idle_entrytime = now;
> > }
>
>
> hmm this part is wrong
> you pick the current cpu, rather than the one denoted by ts.....
>

Hmm. Thanks, good catch.
Well, there is something I'm missing. How can I match given *ts and cpu
in update_ts_time_stats (except for introducing update_ts_time_stats(..., int cpu)) ?

> they will normally be the same, except for the case where you get your
> warning...
> (and this is also why you can't move the get_cpu() inside
> nr_iowait_cpu() ... )
>


Sergey[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2010-06-15 16:49    [W:0.061 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site