Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/spinlocks: Eliminate TICKET_MASK

The definition of it being questionable already (unnecessarily
including a cast), and it being used in a single place that can
be written shorter without it, remove this #define.

Along the same lines, simplify __ticket_spin_is_locked()'s main
expression, which was the more convoluted way because of needs
that went away with the recent type changes by Jeremy.

This is pure cleanup, no functional change intended.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4F2C06020200007800071066@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Jan Beulich and committed by
Ingo Molnar
7931d493 9d8e2277

+2 -3
+2 -2
arch/x86/include/asm/spinlock.h
··· 88 88 { 89 89 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets); 90 90 91 - return !!(tmp.tail ^ tmp.head); 91 + return tmp.tail != tmp.head; 92 92 } 93 93 94 94 static inline int __ticket_spin_is_contended(arch_spinlock_t *lock) 95 95 { 96 96 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets); 97 97 98 - return ((tmp.tail - tmp.head) & TICKET_MASK) > 1; 98 + return (__ticket_t)(tmp.tail - tmp.head) > 1; 99 99 } 100 100 101 101 #ifndef CONFIG_PARAVIRT_SPINLOCKS
-1
arch/x86/include/asm/spinlock_types.h
··· 16 16 #endif 17 17 18 18 #define TICKET_SHIFT (sizeof(__ticket_t) * 8) 19 - #define TICKET_MASK ((__ticket_t)((1 << TICKET_SHIFT) - 1)) 20 19 21 20 typedef struct arch_spinlock { 22 21 union {