aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/smp.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-02-24 10:39:55 -0500
committerJens Axboe <axboe@fb.com>2014-02-24 17:46:47 -0500
commit5fd77595ec62141fa71e575bdbf410e0192f87d0 (patch)
tree9c34d82ab352a92cc260861084b577b3a73f7cba /kernel/smp.c
parent6d113398dcf4dfcd9787a4ead738b186f7b7ff0f (diff)
smp: Iterate functions through llist_for_each_entry_safe()
The IPI function llist iteration is open coded. Lets simplify this with using an llist iterator. Also we want to keep the iteration safe against possible csd.llist->next value reuse from the IPI handler. At least the block subsystem used to do such things so lets stay careful and use llist_for_each_entry_safe(). Signed-off-by: Jan Kara <jack@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jens Axboe <axboe@fb.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'kernel/smp.c')
-rw-r--r--kernel/smp.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/kernel/smp.c b/kernel/smp.c
index ffee35bef179..e3852de042a6 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -151,7 +151,8 @@ static void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
151 */ 151 */
152void generic_smp_call_function_single_interrupt(void) 152void generic_smp_call_function_single_interrupt(void)
153{ 153{
154 struct llist_node *entry, *next; 154 struct llist_node *entry;
155 struct call_single_data *csd, *csd_next;
155 156
156 /* 157 /*
157 * Shouldn't receive this interrupt on a cpu that is not yet online. 158 * Shouldn't receive this interrupt on a cpu that is not yet online.
@@ -161,16 +162,9 @@ void generic_smp_call_function_single_interrupt(void)
161 entry = llist_del_all(&__get_cpu_var(call_single_queue)); 162 entry = llist_del_all(&__get_cpu_var(call_single_queue));
162 entry = llist_reverse_order(entry); 163 entry = llist_reverse_order(entry);
163 164
164 while (entry) { 165 llist_for_each_entry_safe(csd, csd_next, entry, llist) {
165 struct call_single_data *csd;
166
167 next = entry->next;
168
169 csd = llist_entry(entry, struct call_single_data, llist);
170 csd->func(csd->info); 166 csd->func(csd->info);
171 csd_unlock(csd); 167 csd_unlock(csd);
172
173 entry = next;
174 } 168 }
175} 169}
176 170