diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2019-06-08 06:13:57 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2019-06-15 06:25:55 -0400 |
commit | 4ecf0a43e729a7e641d800c294faabe87378fc05 (patch) | |
tree | d7c164a2215c69a17b319076b64dd99ea1f85351 | |
parent | 38f2c691a4b3e89d476f8e8350d1ca299974b89d (diff) |
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>
-rw-r--r-- | arch/s390/include/asm/processor.h | 6 | ||||
-rw-r--r-- | arch/s390/kernel/processor.c | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | include/linux/stop_machine.h | 1 | ||||
-rw-r--r-- | kernel/stop_machine.c | 7 |
5 files changed, 9 insertions, 13 deletions
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 445ce9ee4404..14883b1562e0 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -222,12 +222,6 @@ static __no_kasan_or_inline unsigned short stap(void) | |||
222 | return cpu_address; | 222 | return cpu_address; |
223 | } | 223 | } |
224 | 224 | ||
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 | |||
231 | #define cpu_relax() barrier() | 225 | #define cpu_relax() barrier() |
232 | 226 | ||
233 | #define ECAG_CACHE_ATTRIBUTE 0 | 227 | #define ECAG_CACHE_ATTRIBUTE 0 |
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 4cdaefec1b7c..6ebc2117c66c 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #define KMSG_COMPONENT "cpu" | 7 | #define KMSG_COMPONENT "cpu" |
8 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 8 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
9 | 9 | ||
10 | #include <linux/stop_machine.h> | ||
10 | #include <linux/cpufeature.h> | 11 | #include <linux/cpufeature.h> |
11 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
@@ -59,7 +60,7 @@ void s390_update_cpu_mhz(void) | |||
59 | on_each_cpu(update_cpu_mhz, NULL, 0); | 60 | on_each_cpu(update_cpu_mhz, NULL, 0); |
60 | } | 61 | } |
61 | 62 | ||
62 | void notrace cpu_relax_yield(const struct cpumask *cpumask) | 63 | void notrace stop_machine_yield(const struct cpumask *cpumask) |
63 | { | 64 | { |
64 | int cpu, this_cpu; | 65 | int cpu, this_cpu; |
65 | 66 | ||
@@ -73,7 +74,6 @@ void notrace cpu_relax_yield(const struct cpumask *cpumask) | |||
73 | smp_yield_cpu(cpu); | 74 | smp_yield_cpu(cpu); |
74 | } | 75 | } |
75 | } | 76 | } |
76 | EXPORT_SYMBOL(cpu_relax_yield); | ||
77 | 77 | ||
78 | /* | 78 | /* |
79 | * cpu_init - initializes state that is per-CPU. | 79 | * cpu_init - initializes state that is per-CPU. |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1f9f3160da7e..911675416b05 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1518,10 +1518,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpuma | |||
1518 | } | 1518 | } |
1519 | #endif | 1519 | #endif |
1520 | 1520 | ||
1521 | #ifndef cpu_relax_yield | ||
1522 | #define cpu_relax_yield(cpumask) cpu_relax() | ||
1523 | #endif | ||
1524 | |||
1525 | extern int yield_to(struct task_struct *p, bool preempt); | 1521 | extern int yield_to(struct task_struct *p, bool preempt); |
1526 | extern void set_user_nice(struct task_struct *p, long nice); | 1522 | extern void set_user_nice(struct task_struct *p, long nice); |
1527 | extern int task_prio(const struct task_struct *p); | 1523 | extern int task_prio(const struct task_struct *p); |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 6d3635c86dbe..f9a0c6189852 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
@@ -36,6 +36,7 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); | |||
36 | int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); | 36 | int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); |
37 | void stop_machine_park(int cpu); | 37 | void stop_machine_park(int cpu); |
38 | void stop_machine_unpark(int cpu); | 38 | void stop_machine_unpark(int cpu); |
39 | void stop_machine_yield(const struct cpumask *cpumask); | ||
39 | 40 | ||
40 | #else /* CONFIG_SMP */ | 41 | #else /* CONFIG_SMP */ |
41 | 42 | ||
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index b8b0c5ff8da9..b4f83f7bdf86 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
@@ -177,6 +177,11 @@ static void ack_state(struct multi_stop_data *msdata) | |||
177 | set_state(msdata, msdata->state + 1); | 177 | set_state(msdata, msdata->state + 1); |
178 | } | 178 | } |
179 | 179 | ||
180 | void __weak stop_machine_yield(const struct cpumask *cpumask) | ||
181 | { | ||
182 | cpu_relax(); | ||
183 | } | ||
184 | |||
180 | /* This is the cpu_stop function which stops the CPU. */ | 185 | /* This is the cpu_stop function which stops the CPU. */ |
181 | static int multi_cpu_stop(void *data) | 186 | static int multi_cpu_stop(void *data) |
182 | { | 187 | { |
@@ -204,7 +209,7 @@ static int multi_cpu_stop(void *data) | |||
204 | /* Simple state machine */ | 209 | /* Simple state machine */ |
205 | do { | 210 | do { |
206 | /* Chill out and ensure we re-read multi_stop_state. */ | 211 | /* Chill out and ensure we re-read multi_stop_state. */ |
207 | cpu_relax_yield(cpumask); | 212 | stop_machine_yield(cpumask); |
208 | if (msdata->state != curstate) { | 213 | if (msdata->state != curstate) { |
209 | curstate = msdata->state; | 214 | curstate = msdata->state; |
210 | switch (curstate) { | 215 | switch (curstate) { |