lkml.org 
[lkml]   [2015]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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.


    \
     
     \ /
      Last update: 2015-06-08 13:21    [W:6.252 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site