lkml.org 
[lkml]   [2018]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] blk-wbt: get back the missed wakeup from __wbt_done
    From
    Date
    Hi Jens

    On 08/25/2018 11:41 PM, Jens Axboe wrote:
    > do {
    > - set_current_state(TASK_UNINTERRUPTIBLE);
    > + if (test_bit(0, &data.flags))
    > + break;
    >
    > - if (!has_sleeper && rq_wait_inc_below(rqw, get_limit(rwb, rw)))
    > + WARN_ON_ONCE(list_empty(&data.wq.entry));
    > +
    > + if (!has_sleeper &&
    > + rq_wait_inc_below(rqw, get_limit(rwb, rw))) {
    > + finish_wait(&rqw->wait, &data.wq);
    > +
    > + /*
    > + * We raced with wbt_wake_function() getting a token,
    > + * which means we now have two. Put ours and wake
    > + * anyone else potentially waiting for one.
    > + */
    > + if (test_bit(0, &data.flags))
    > + wbt_rqw_done(rwb, rqw, wb_acct);
    > break;

    Just use 'bool' variable should be OK
    After finish_wait, no one could race with us here.

    > + }
    >
    > if (lock) {
    > spin_unlock_irq(lock);
    > @@ -511,11 +569,11 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct,
    > spin_lock_irq(lock);
    > } else
    > io_schedule();
    > +
    > has_sleeper = false;
    > } while (1);

    I cannot get the point of "since we can't rely on just being woken from the ->func handler
    we set".
    Do you mean there could be someone else could wake up this task ?

    Thanks
    Jianchao

    \
     
     \ /
      Last update: 2018-08-27 05:53    [W:3.344 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site