[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 12 Dec 2013 18:17:53 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] wait-simple: Introduce the simple waitqueue
implementation
On Thu, Dec 12, 2013 at 12:10:15PM -0500, Steven Rostedt wrote:
> So if we break up your code above, we have:
>
> raw_spin_lock_irqsave(&head->lock, flags);
> w->task = current;
> if (list_empty(&w->node)) {
> list_add(&w->node, &head->list);
> smp_mb();
> }
> __set_current_state(state);
> raw_spin_unlock_irqrestore(&head->lock, flags);
>
> if (!cond)
> schedule();
>
the unlock is semi-permeable and would allow the cond test to cross over
and even be satisfied before the state write.
>
> vs
>
> cond = true;
>
> raw_spin_lock_irqsave(&head->lock, flags);
> woken = __swait_wake_locked(head, state, num);
> raw_spin_unlock_irqrestore(&head->lock, flags);
Same here, the lock is semi-permeable and would allow the cond store to
leak down.
In the first case we really need the implied mb of set_current_state(),
the the second case the actual wakeup would still provide the required
barrier.
--
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