Skip to content

Commit 4ecf0a4

Browse files
committed
processor: get rid of cpu_relax_yield
stop_machine is the only user left of cpu_relax_yield. Given that it now has special semantics which are tied to stop_machine introduce a weak stop_machine_yield function which architectures can override, and get rid of the generic cpu_relax_yield implementation. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
1 parent 38f2c69 commit 4ecf0a4

5 files changed

Lines changed: 9 additions & 13 deletions

File tree

‎arch/s390/include/asm/processor.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,6 @@ static __no_kasan_or_inline unsigned short stap(void)
222222
return cpu_address;
223223
}
224224

225-
/*
226-
* Give up the time slice of the virtual PU.
227-
*/
228-
#define cpu_relax_yield cpu_relax_yield
229-
void cpu_relax_yield(const struct cpumask *cpumask);
230-
231225
#define cpu_relax() barrier()
232226

233227
#define ECAG_CACHE_ATTRIBUTE 0

‎arch/s390/kernel/processor.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define KMSG_COMPONENT "cpu"
88
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
99

10+
#include <linux/stop_machine.h>
1011
#include <linux/cpufeature.h>
1112
#include <linux/bitops.h>
1213
#include <linux/kernel.h>
@@ -59,7 +60,7 @@ void s390_update_cpu_mhz(void)
5960
on_each_cpu(update_cpu_mhz, NULL, 0);
6061
}
6162

62-
void notrace cpu_relax_yield(const struct cpumask *cpumask)
63+
void notrace stop_machine_yield(const struct cpumask *cpumask)
6364
{
6465
int cpu, this_cpu;
6566

@@ -73,7 +74,6 @@ void notrace cpu_relax_yield(const struct cpumask *cpumask)
7374
smp_yield_cpu(cpu);
7475
}
7576
}
76-
EXPORT_SYMBOL(cpu_relax_yield);
7777

7878
/*
7979
* cpu_init - initializes state that is per-CPU.

‎include/linux/sched.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,10 +1518,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpuma
15181518
}
15191519
#endif
15201520

1521-
#ifndef cpu_relax_yield
1522-
#define cpu_relax_yield(cpumask) cpu_relax()
1523-
#endif
1524-
15251521
extern int yield_to(struct task_struct *p, bool preempt);
15261522
extern void set_user_nice(struct task_struct *p, long nice);
15271523
extern int task_prio(const struct task_struct *p);

‎include/linux/stop_machine.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
3636
int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
3737
void stop_machine_park(int cpu);
3838
void stop_machine_unpark(int cpu);
39+
void stop_machine_yield(const struct cpumask *cpumask);
3940

4041
#else /* CONFIG_SMP */
4142

‎kernel/stop_machine.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ static void ack_state(struct multi_stop_data *msdata)
177177
set_state(msdata, msdata->state + 1);
178178
}
179179

180+
void __weak stop_machine_yield(const struct cpumask *cpumask)
181+
{
182+
cpu_relax();
183+
}
184+
180185
/* This is the cpu_stop function which stops the CPU. */
181186
static int multi_cpu_stop(void *data)
182187
{
@@ -204,7 +209,7 @@ static int multi_cpu_stop(void *data)
204209
/* Simple state machine */
205210
do {
206211
/* Chill out and ensure we re-read multi_stop_state. */
207-
cpu_relax_yield(cpumask);
212+
stop_machine_yield(cpumask);
208213
if (msdata->state != curstate) {
209214
curstate = msdata->state;
210215
switch (curstate) {

0 commit comments

Comments
 (0)