summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAvi Weiss <thnkslprpt@gmail.com>2026-10-20 15:55:18 +0300
committerFrederic Weisbecker <frederic@kernel.org>2026-10-25 19:53:54 +0100
commit78ff77ded78f2d3d6040705a3ab5a83cc45275e3 (patch)
treee73b0408b830e1c81aac4d92b21424382e77c63e /kernel
parentc03c1a14507dfaf8b856c2608f9ac216021fc222 (diff)
kthread: Fall back when no preferred housekeeping CPU is online
kthread_fetch_affinity() falls back to the housekeeping mask only when the intersection with the preferred mask is empty. If the intersection contains only offline CPUs, set_cpus_allowed_ptr() returns -EINVAL and the kthread keeps its previous affinity, which may still include an isolated CPU. Check whether the intersection contains an online CPU instead. Fall back to the full housekeeping mask when none are online. Fixes: e894f6339808 ("kthread: Honour kthreads preferred affinity after cpuset changes") Signed-off-by: Avi Weiss <thnkslprpt@gmail.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kthread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index a3f95c90456b..0dbff3b68ffb 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -343,7 +343,7 @@ static void kthread_fetch_affinity(struct kthread *kthread, struct cpumask *cpum
}
cpumask_and(cpumask, pref, housekeeping_cpumask(HK_TYPE_DOMAIN));
- if (cpumask_empty(cpumask))
+ if (!cpumask_intersects(cpumask, cpu_online_mask))
cpumask_copy(cpumask, housekeeping_cpumask(HK_TYPE_DOMAIN));
}