Skip to content

Commit

Permalink
locking/csd_lock: Use smp_cond_acquire() in csd_lock_wait()
Browse files Browse the repository at this point in the history
We can micro-optimize this call and mildly relax the
barrier requirements by relying on ctrl + rmb, keeping
the acquire semantics. In addition, this is pretty much
the now standard for busy-waiting under such restraints.

Signed-off-by: Davidlohr Bueso <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Davidlohr Bueso authored and Ingo Molnar committed Mar 10, 2016
1 parent 90d1098 commit 38460a2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ void __init call_function_init(void)
*/
static __always_inline void csd_lock_wait(struct call_single_data *csd)
{
while (smp_load_acquire(&csd->flags) & CSD_FLAG_LOCK)
cpu_relax();
smp_cond_acquire(!(csd->flags & CSD_FLAG_LOCK));
}

static __always_inline void csd_lock(struct call_single_data *csd)
Expand Down

0 comments on commit 38460a2

Please sign in to comment.