]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kthread: Document kthread_affine_preferred()
authorFrederic Weisbecker <frederic@kernel.org>
Tue, 26 Aug 2025 15:16:48 +0000 (17:16 +0200)
committerFrederic Weisbecker <frederic@kernel.org>
Tue, 3 Feb 2026 14:23:35 +0000 (15:23 +0100)
The documentation of this new API has been overlooked during its
introduction. Fill the gap.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
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: Waiman Long <longman@redhat.com>
kernel/kthread.c

index 51f419139dea77a94d440f3bf500644ee27b6928..c50f4c0eabfe9cb8585a9f0e6bed658230ee866f 100644 (file)
@@ -856,6 +856,18 @@ int kthreadd(void *unused)
        return 0;
 }
 
+/**
+ * kthread_affine_preferred - Define a kthread's preferred affinity
+ * @p: thread created by kthread_create().
+ * @mask: preferred mask of CPUs (might not be online, must be possible) for @p
+ *        to run on.
+ *
+ * Similar to kthread_bind_mask() except that the affinity is not a requirement
+ * but rather a preference that can be constrained by CPU isolation or CPU hotplug.
+ * Must be called before the first wakeup of the kthread.
+ *
+ * Returns 0 if the affinity has been applied.
+ */
 int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
 {
        struct kthread *kthread = to_kthread(p);