Re: [thiscpuops upgrade 10/10] Lockless (and preemptless) fastpathsfor slub

From: Christoph Lameter
Date: Tue Nov 23 2010 - 23:37:45 EST


Use power of two increment in all cases.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/