From ea82cc601b2b5fd1a4ab0fc35ffe218a9317a7e5 Mon Sep 17 00:00:00 2001 From: "Luck, Tony" Date: Tue, 3 Sep 2013 14:49:49 -0700 Subject: [PATCH] lockref: Relax in cmpxchg loop While we are likley to succeed and break out of this loop, it isn't guaranteed. We should be power and thread friendly if we do have to go around for a second (or third, or more) attempt. Signed-off-by: Tony Luck Signed-off-by: Linus Torvalds --- lib/lockref.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/lockref.c b/lib/lockref.c index 7819c2d1d315e..9d76f404ce9a6 100644 --- a/lib/lockref.c +++ b/lib/lockref.c @@ -19,6 +19,7 @@ if (likely(old.lock_count == prev.lock_count)) { \ SUCCESS; \ } \ + cpu_relax(); \ } \ } while (0) -- 2.39.5