diff options
Diffstat (limited to 'include/linux/smp.h')
-rw-r--r-- | include/linux/smp.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/smp.h b/include/linux/smp.h index 8cc38d3bab0c..10530d92c04b 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -102,6 +102,22 @@ static inline void call_function_init(void) { } | |||
102 | int on_each_cpu(smp_call_func_t func, void *info, int wait); | 102 | int on_each_cpu(smp_call_func_t func, void *info, int wait); |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Call a function on processors specified by mask, which might include | ||
106 | * the local one. | ||
107 | */ | ||
108 | void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, | ||
109 | void *info, bool wait); | ||
110 | |||
111 | /* | ||
112 | * Call a function on each processor for which the supplied function | ||
113 | * cond_func returns a positive value. This may include the local | ||
114 | * processor. | ||
115 | */ | ||
116 | void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), | ||
117 | smp_call_func_t func, void *info, bool wait, | ||
118 | gfp_t gfp_flags); | ||
119 | |||
120 | /* | ||
105 | * Mark the boot cpu "online" so that it can call console drivers in | 121 | * Mark the boot cpu "online" so that it can call console drivers in |
106 | * printk() and can access its per-cpu storage. | 122 | * printk() and can access its per-cpu storage. |
107 | */ | 123 | */ |
@@ -132,6 +148,36 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info) | |||
132 | local_irq_enable(); \ | 148 | local_irq_enable(); \ |
133 | 0; \ | 149 | 0; \ |
134 | }) | 150 | }) |
151 | /* | ||
152 | * Note we still need to test the mask even for UP | ||
153 | * because we actually can get an empty mask from | ||
154 | * code that on SMP might call us without the local | ||
155 | * CPU in the mask. | ||
156 | */ | ||
157 | #define on_each_cpu_mask(mask, func, info, wait) \ | ||
158 | do { \ | ||
159 | if (cpumask_test_cpu(0, (mask))) { \ | ||
160 | local_irq_disable(); \ | ||
161 | (func)(info); \ | ||
162 | local_irq_enable(); \ | ||
163 | } \ | ||
164 | } while (0) | ||
165 | /* | ||
166 | * Preemption is disabled here to make sure the cond_func is called under the | ||
167 | * same condtions in UP and SMP. | ||
168 | */ | ||
169 | #define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\ | ||
170 | do { \ | ||
171 | void *__info = (info); \ | ||
172 | preempt_disable(); \ | ||
173 | if ((cond_func)(0, __info)) { \ | ||
174 | local_irq_disable(); \ | ||
175 | (func)(__info); \ | ||
176 | local_irq_enable(); \ | ||
177 | } \ | ||
178 | preempt_enable(); \ | ||
179 | } while (0) | ||
180 | |||
135 | static inline void smp_send_reschedule(int cpu) { } | 181 | static inline void smp_send_reschedule(int cpu) { } |
136 | #define num_booting_cpus() 1 | 182 | #define num_booting_cpus() 1 |
137 | #define smp_prepare_boot_cpu() do {} while (0) | 183 | #define smp_prepare_boot_cpu() do {} while (0) |