]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kthread: Rely on HK_TYPE_DOMAIN for preferred affinity management
authorFrederic Weisbecker <frederic@kernel.org>
Mon, 2 Jun 2025 19:21:55 +0000 (21:21 +0200)
committerFrederic Weisbecker <frederic@kernel.org>
Tue, 3 Feb 2026 14:23:35 +0000 (15:23 +0100)
Unbound kthreads want to run neither on nohz_full CPUs nor on domain
isolated CPUs. And since nohz_full implies domain isolation, checking
the latter is enough to verify both.

Therefore exclude kthreads from domain isolation.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Cc: Marco Crivellari <marco.crivellari@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
kernel/kthread.c

index 85ccf5bb17c9e323e3bdd32d94ed775f608a1612..968fa5868d2162b757ad60efa1029993745197a2 100644 (file)
@@ -362,18 +362,20 @@ static void kthread_fetch_affinity(struct kthread *kthread, struct cpumask *cpum
 {
        const struct cpumask *pref;
 
+       guard(rcu)();
+
        if (kthread->preferred_affinity) {
                pref = kthread->preferred_affinity;
        } else {
                if (kthread->node == NUMA_NO_NODE)
-                       pref = housekeeping_cpumask(HK_TYPE_KTHREAD);
+                       pref = housekeeping_cpumask(HK_TYPE_DOMAIN);
                else
                        pref = cpumask_of_node(kthread->node);
        }
 
-       cpumask_and(cpumask, pref, housekeeping_cpumask(HK_TYPE_KTHREAD));
+       cpumask_and(cpumask, pref, housekeeping_cpumask(HK_TYPE_DOMAIN));
        if (cpumask_empty(cpumask))
-               cpumask_copy(cpumask, housekeeping_cpumask(HK_TYPE_KTHREAD));
+               cpumask_copy(cpumask, housekeeping_cpumask(HK_TYPE_DOMAIN));
 }
 
 static void kthread_affine_node(void)