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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/