cpu/hotplug: Simplify access to percpu cpuhp_state
authorYuan ZhaoXiong <yuanzhaoxiong@baidu.com>
Sun, 23 May 2021 13:31:30 +0000 (21:31 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 25 May 2021 15:24:52 +0000 (17:24 +0200)
It is unnecessary to invoke per_cpu_ptr() everytime to access cpuhp_state.
Use the available pointer instead.

Signed-off-by: Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lore.kernel.org/r/1621776690-13264-1-git-send-email-yuanzhaoxiong@baidu.com
kernel/cpu.c

index e538518556f47da89d52fec50a4419a942200f0d..2942cb4644c558310f2fc6e219446d3cfa031708 100644 (file)
@@ -961,7 +961,7 @@ static int takedown_cpu(unsigned int cpu)
        int err;
 
        /* Park the smpboot threads */
-       kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+       kthread_park(st->thread);
 
        /*
         * Prevent irq alloc/free while the dying cpu reorganizes the
@@ -977,7 +977,7 @@ static int takedown_cpu(unsigned int cpu)
                /* CPU refused to die */
                irq_unlock_sparse();
                /* Unpark the hotplug thread so we can rollback there */
-               kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
+               kthread_unpark(st->thread);
                return err;
        }
        BUG_ON(cpu_online(cpu));