Messages in this thread Patch in this message | | | Date | Tue, 23 Nov 2010 22:37:37 -0600 (CST) | From | Christoph Lameter <> | Subject | Re: [thiscpuops upgrade 10/10] Lockless (and preemptless) fastpaths for slub |
| |
Use power of two increment in all cases.
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2010-11-23 22:22:03.596998064 -0600 +++ linux-2.6/mm/slub.c 2010-11-23 21:53:09.422591631 -0600 @@ -1490,19 +1490,21 @@ * during cmpxchg. The transactions start with the cpu number and are then * incremented by CONFIG_NR_CPUS. */ +#define TID_STEP roundup_pow_of_two(CONFIG_NR_CPUS) + static inline unsigned long next_tid(unsigned long tid) { - return tid + CONFIG_NR_CPUS; + return tid + TID_STEP; }
static inline unsigned int tid_to_cpu(unsigned long tid) { - return tid % CONFIG_NR_CPUS; + return tid % TID_STEP; }
static inline unsigned long tid_to_event(unsigned long tid) { - return tid / CONFIG_NR_CPUS; + return tid / TID_STEP; }
static inline unsigned int init_tid(int cpu)
| |