lkml.org 
[lkml]   [2015]   [Jun]   [10]   [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
    Forgot to mention...

    On 06/09, Oleg Nesterov wrote:
    >
    > And. Note that we can rewrite these 2 "write" critical sections in
    > __run_hrtimer() and enqueue_hrtimer() as
    >
    > cpu_base->running = timer;
    >
    > write_seqcount_begin(cpu_base->seq);
    > write_seqcount_end(cpu_base->seq);
    >
    > __remove_hrtimer(timer);
    >
    > and
    >
    > timer->state |= HRTIMER_STATE_ENQUEUED;
    >
    > write_seqcount_begin(cpu_base->seq);
    > write_seqcount_end(cpu_base->seq);
    >
    > base->running = NULL;
    >
    > So we can probably use write_seqcount_barrier() except I am not sure
    > about the 2nd wmb...

    Or we can change hrtimer_active() to use raw_read_seqcount() likes your
    patch does (avoid odd/even games) and then __run_hrtimer() can use
    raw_write_seqcount_latch(), it already has wmb's on both sides.

    I am not even sure we need the "if (base->cpu_base->running == timer)"
    optimization for the 2nd _latch(), we cando this unconditionally in
    __run_hrtimer().

    And in this case the code will look very much like your patch, but
    imo at the same it will look much more understandable. Because, again,
    this way we just add 2 critical "write" sections (barriers) into
    __run_hrtimer(), no need to explain the usage of memory barriers, etc,
    we can simply rely on acquire/release semantics of seqcount_t.

    But yes. This adds 2 additional wmb's into run_hrtimer(). Again, we
    can make the 2nd _latch() condtitional, we only need it if the timer
    requeues itself, but I am not sure.



    Finally. You know, I am afraid very much I confused myself completely
    and now I am trying to confuse you and Kirill ;)

    Oleg.



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