padata: ensure the reorder timer callback runs on the correct CPU
authorMathias Krause <minipli@googlemail.com>
Fri, 8 Sep 2017 18:57:10 +0000 (20:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 14:42:50 +0000 (16:42 +0200)
commita68ca9a23e83c3e1003e091d1ce802b821efc5db
tree9f7bec938c9f0a04bf3cea0485cfb60d5b999e8f
parentf1f3b4150baf7c3aa6b4e6b81b8ff1909996d507
padata: ensure the reorder timer callback runs on the correct CPU

commit cf5868c8a22dc2854b96e9569064bb92365549ca upstream.

The reorder timer function runs on the CPU where the timer interrupt was
handled which is not necessarily one of the CPUs of the 'pcpu' CPU mask
set.

Ensure the padata_reorder() callback runs on the correct CPU, which is
one in the 'pcpu' CPU mask set and, preferrably, the next expected one.
Do so by comparing the current CPU with the expected target CPU. If they
match, call padata_reorder() right away. If they differ, schedule a work
item on the target CPU that does the padata_reorder() call for us.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/padata.h
kernel/padata.c