lkml.org 
[lkml]   [2010]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 4/4] futex: convert hash_bucket locks to raw_spinlock_t
    From
    Date
    On Sun, 2010-07-11 at 15:33 +0200, Mike Galbraith wrote:
    > On Sat, 2010-07-10 at 21:41 +0200, Mike Galbraith wrote:

    > diff --git a/kernel/futex.c b/kernel/futex.c
    > index a6cec32..ef489f3 100644
    > --- a/kernel/futex.c
    > +++ b/kernel/futex.c
    > @@ -2255,7 +2255,14 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
    > /* Queue the futex_q, drop the hb lock, wait for wakeup. */
    > futex_wait_queue_me(hb, &q, to);
    >
    > - spin_lock(&hb->lock);
    > + /*
    > + * Non-blocking synchronization point with futex_requeue().
    > + *
    > + * We dare not block here because this will alter PI state, possibly
    > + * before our waker finishes modifying same in wakeup_next_waiter().
    > + */
    > + while(!spin_trylock(&hb->lock))
    > + cpu_relax();

    I agree that this would work. But I wonder if this should have an:

    #ifdef PREEMPT_RT
    [...]
    #else
    spin_lock(&hb->lock);
    #endif

    around it. Or encapsulate this lock in a macro that does the same thing
    (just to keep the actual code cleaner)

    -- Steve

    > ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to);
    > spin_unlock(&hb->lock);
    > if (ret)
    >
    >




    \
     
     \ /
      Last update: 2010-07-12 13:47    [W:0.031 / U:0.732 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site