Q: incorrect llist_empty() call in flush_smp_call_function_queue ?
From: Luigi Rizzo
Date: Sat Jun 22 2019 - 13:54:52 EST
flush_smp_call_function_queue() starts with the code below.
My impression is that the !llist_empty(head) term below is wrong
and should be replaced by !entry
llist_del_all(head) is xchg(&head->first, NULL) so it leaves the list empty,
the only chance that !llist_empty(head) is true is when a new element is
added between llist_del_add and the test of the condition, whereas judging
from the comment the intent seems to be that the warning should be printed
also when there are previous elements.
static void flush_smp_call_function_queue(bool warn_cpu_offline)
{
...
head = this_cpu_ptr(&call_single_queue);
entry = llist_del_all(head);
entry = llist_reverse_order(entry);
/* There shouldn't be any pending callbacks on an offline CPU. */
if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) &&
!warned && !llist_empty(head))) {
warned = true;
WARN(1, "IPI on offline CPU %d\n", smp_processor_id());
--
cheers
luigi