From: Luck, Tony Date: Tue, 3 Sep 2013 21:49:49 +0000 (-0700) Subject: lockref: Relax in cmpxchg loop X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d472d9d98b463dd7a04f2bcdeafe4261686ce6ab;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 --- diff --git a/lib/lockref.c b/lib/lockref.c index 7819c2d1d315..9d76f404ce9a 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)