[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150608105514.GV18673@twins.programming.kicks-ass.net>
Date: Mon, 8 Jun 2015 12:55:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: umgwanakikbuti@...il.com, mingo@...e.hu, ktkhai@...allels.com,
rostedt@...dmis.org, tglx@...utronix.de, juri.lelli@...il.com,
pang.xunlei@...aro.org, wanpeng.li@...ux.intel.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/14] hrtimer: Allow hrtimer::function() to free the
timer
On Mon, Jun 08, 2015 at 11:14:17AM +0200, Peter Zijlstra wrote:
> On Mon, Jun 08, 2015 at 12:33:17AM +0200, Oleg Nesterov wrote:
> > Not sure I read this patch correctly, it doesn't apply to Linus's tree.
>
> I was working on tip/master, there's a number of timer patches in there.
>
> > And I simply can not understand the complication in hrtimer_active(),
> > please help!
> >
> > On 06/05, Peter Zijlstra wrote:
> > >
> > > +bool hrtimer_active(const struct hrtimer *timer)
> > > +{
> > > + struct hrtimer_cpu_base *cpu_base;
> > > + unsigned int seq;
> > > + bool active;
> > > +
> > > + do {
> > > + active = false;
> > > + cpu_base = READ_ONCE(timer->base->cpu_base);
> > > + seq = raw_read_seqcount(&cpu_base->seq);
> > > +
> > > + if (timer->state != HRTIMER_STATE_INACTIVE ||
> > > + cpu_base->running == timer)
> > > + active = true;
> >
> > Why we can't simply return true in this case?
> >
> > Unless you lock this timer, hrtimer_active() is inherently racy anyway.
> > Granted, it must not wrongly return False if the timer is pending or
> > running.
> >
> > But "false positive" does not differ from the case when (say) the
> > running timer->function() finishes right after hrtimer_active() returns
> > True.
OK I can't read; you asked why delay the return true inside that loop.
Yes we can as per your argument. I think I ended up being too paranoid
or something.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists