[RFC][PATCH RT 3/6] idr: Use migrate_disable() to stay on the current CPU

From: Steven Rostedt
Date: Wed Jun 26 2013 - 15:32:54 EST


idr_preload() and idr_preload_end() use preempt_disable() to keep the process
from migrating. For mainline that's fine, but for -rt, that has issues as
the spin_locks in between are changed to mutexes.

Use migrated_disable/enable() instead.

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

Index: linux-rt.git/include/linux/idr.h
===================================================================
--- linux-rt.git.orig/include/linux/idr.h
+++ linux-rt.git/include/linux/idr.h
@@ -94,7 +94,7 @@ void idr_init(struct idr *idp);
*/
static inline void idr_preload_end(void)
{
- preempt_enable();
+ migrate_enable();
}

/**
Index: linux-rt.git/lib/idr.c
===================================================================
--- linux-rt.git.orig/lib/idr.c
+++ linux-rt.git/lib/idr.c
@@ -423,7 +423,7 @@ void idr_preload(gfp_t gfp_mask)
WARN_ON_ONCE(in_interrupt());
might_sleep_if(gfp_mask & __GFP_WAIT);

- preempt_disable();
+ migrate_disable();

/*
* idr_alloc() is likely to succeed w/o full idr_layer buffer and
@@ -435,9 +435,9 @@ void idr_preload(gfp_t gfp_mask)
while (__this_cpu_read(idr_preload_cnt) < MAX_IDR_FREE) {
struct idr_layer *new;

- preempt_enable();
+ migrate_enable();
new = kmem_cache_zalloc(idr_layer_cache, gfp_mask);
- preempt_disable();
+ migrate_disable();
if (!new)
break;


--
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/