lkml.org 
[lkml]   [2010]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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)


\
 
 \ /
  Last update: 2010-11-24 05:39    [W:0.103 / U:0.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site