summaryrefslogtreecommitdiffstats
path: root/patches/0169-local-vars-migrate-disable.patch.patch
blob: 56b76c51c3c03c20e1711fda9411fe0da2b00bc2 (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
From 8a8dec23a3dc3e15c14966d76a1d148c54d79631 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 28 Jun 2011 20:42:16 +0200
Subject: [PATCH 169/270] local-vars-migrate-disable.patch

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/percpu.h |   28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 3d13ce0..5a56f183 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -48,10 +48,30 @@
 	preempt_enable();				\
 } while (0)
 
-#define get_local_var(var)	get_cpu_var(var)
-#define put_local_var(var)	put_cpu_var(var)
-#define get_local_ptr(var)	get_cpu_ptr(var)
-#define put_local_ptr(var)	put_cpu_ptr(var)
+#ifndef CONFIG_PREEMPT_RT_FULL
+# define get_local_var(var)	get_cpu_var(var)
+# define put_local_var(var)	put_cpu_var(var)
+# define get_local_ptr(var)	get_cpu_ptr(var)
+# define put_local_ptr(var)	put_cpu_ptr(var)
+#else
+# define get_local_var(var) (*({			\
+	migrate_disable();				\
+	&__get_cpu_var(var); }))
+
+# define put_local_var(var) do {			\
+	(void)&(var);					\
+	migrate_enable();				\
+} while (0)
+
+# define get_local_ptr(var) ({				\
+	migrate_disable();				\
+	this_cpu_ptr(var); })
+
+# define put_local_ptr(var) do {			\
+	(void)(var);					\
+	migrate_enable();				\
+} while (0)
+#endif
 
 /* minimum unit size, also is the maximum supported allocation size */
 #define PCPU_MIN_UNIT_SIZE		PFN_ALIGN(32 << 10)
-- 
1.7.10.4