]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0103-hotplug-Reread-hotplug_pcp-on-pin_current_cpu-retry.patch
Fix memguard and related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0103-hotplug-Reread-hotplug_pcp-on-pin_current_cpu-retry.patch
1 From dc2bba8f3fb50c82a0de823c03eb88f3c8c205d8 Mon Sep 17 00:00:00 2001
2 From: Yong Zhang <yong.zhang0@gmail.com>
3 Date: Thu, 28 Jul 2011 11:16:00 +0800
4 Subject: [PATCH 103/366] hotplug: Reread hotplug_pcp on pin_current_cpu()
5  retry
6
7 When retry happens, it's likely that the task has been migrated to
8 another cpu (except unplug failed), but it still derefernces the
9 original hotplug_pcp per cpu data.
10
11 Update the pointer to hotplug_pcp in the retry path, so it points to
12 the current cpu.
13
14 Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
15 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
16 Link: http://lkml.kernel.org/r/20110728031600.GA338@windriver.com
17 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
18 ---
19  kernel/cpu.c | 4 +++-
20  1 file changed, 3 insertions(+), 1 deletion(-)
21
22 diff --git a/kernel/cpu.c b/kernel/cpu.c
23 index 218c7a1..04df252 100644
24 --- a/kernel/cpu.c
25 +++ b/kernel/cpu.c
26 @@ -109,9 +109,11 @@ static DEFINE_PER_CPU(struct hotplug_pcp, hotplug_pcp);
27   */
28  void pin_current_cpu(void)
29  {
30 -       struct hotplug_pcp *hp = this_cpu_ptr(&hotplug_pcp);
31 +       struct hotplug_pcp *hp;
32  
33  retry:
34 +       hp = this_cpu_ptr(&hotplug_pcp);
35 +
36         if (!hp->unplug || hp->refcount || preempt_count() > 1 ||
37             hp->unplug == current) {
38                 hp->refcount++;
39 -- 
40 1.9.1
41