summaryrefslogtreecommitdiffstats
path: root/patches/radix-tree-rt-aware.patch
blob: dd58a92b3de019579b6ba43fbb0c90a3640931a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Subject: radix-tree-rt-aware.patch
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 17 Jul 2011 21:33:18 +0200

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/radix-tree.h |    8 +++++++-
 lib/radix-tree.c           |    5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

Index: linux-3.4/include/linux/radix-tree.h
===================================================================
--- linux-3.4.orig/include/linux/radix-tree.h
+++ linux-3.4/include/linux/radix-tree.h
@@ -230,7 +230,13 @@ unsigned long radix_tree_next_hole(struc
 				unsigned long index, unsigned long max_scan);
 unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
 				unsigned long index, unsigned long max_scan);
+
+#ifndef CONFIG_PREEMPT_RT_FULL
 int radix_tree_preload(gfp_t gfp_mask);
+#else
+static inline int radix_tree_preload(gfp_t gm) { return 0; }
+#endif
+
 void radix_tree_init(void);
 void *radix_tree_tag_set(struct radix_tree_root *root,
 			unsigned long index, unsigned int tag);
@@ -255,7 +261,7 @@ unsigned long radix_tree_locate_item(str
 
 static inline void radix_tree_preload_end(void)
 {
-	preempt_enable();
+	preempt_enable_nort();
 }
 
 /**
Index: linux-3.4/lib/radix-tree.c
===================================================================
--- linux-3.4.orig/lib/radix-tree.c
+++ linux-3.4/lib/radix-tree.c
@@ -202,12 +202,13 @@ radix_tree_node_alloc(struct radix_tree_
 		 * succeed in getting a node here (and never reach
 		 * kmem_cache_alloc)
 		 */
-		rtp = &__get_cpu_var(radix_tree_preloads);
+		rtp = &get_cpu_var(radix_tree_preloads);
 		if (rtp->nr) {
 			ret = rtp->nodes[rtp->nr - 1];
 			rtp->nodes[rtp->nr - 1] = NULL;
 			rtp->nr--;
 		}
+		put_cpu_var(radix_tree_preloads);
 	}
 	if (ret == NULL)
 		ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
@@ -242,6 +243,7 @@ radix_tree_node_free(struct radix_tree_n
 	call_rcu(&node->rcu_head, radix_tree_node_rcu_free);
 }
 
+#ifndef CONFIG_PREEMPT_RT_FULL
 /*
  * Load up this CPU's radix_tree_node buffer with sufficient objects to
  * ensure that the addition of a single element in the tree cannot fail.  On
@@ -276,6 +278,7 @@ out:
 	return ret;
 }
 EXPORT_SYMBOL(radix_tree_preload);
+#endif
 
 /*
  *	Return the maximum key which can be store into a