Skip to content

Commit

Permalink
cpu/hotplug: Simplify access to percpu cpuhp_state
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Yuan ZhaoXiong authored and Thomas Gleixner committed May 25, 2021
1 parent c468154 commit 1307083
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
Expand Down

0 comments on commit 1307083

Please sign in to comment.