From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07CB8311940; Thu, 1 Jan 2026 22:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767305917; cv=none; b=kkvnOcWHlp3/BTUlFHt5bItWnyvVJvLHr2QBeSNNMuinaVbu6fituN0yRNH8B/aGOMTFaJbuBeU4nAYW3xlSHce4n74SVH2L5Sh3tOYROcWxneYpBB5HNestj4sxjXVXgaq0pv1Jd8sCoAKjc5reXgpxzqIrlqUC8Bk9ALTMmVk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767305917; c=relaxed/simple; bh=kluxsGzh3yUyBuEdMQW2ChyzrN9Wa4B73tu4Iho0QMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CS+v4mGmaW9EEcxXpngiz46e6NBz1fnx4L5dXfqXcIGAznvIYCIxvG2guhbX1wW+SplMJ8yy6fxzjAzpcYMul5KBF4HTFwQNPKVkHg7MsgsRhWNptMkaM5VkG8us/hj6p3NCnwi1ojgq8hb5Jgbs+NQYsHaz50usMDX9qYJY8kQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sCUxHlmB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sCUxHlmB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9BBC4CEF7; Thu, 1 Jan 2026 22:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767305916; bh=kluxsGzh3yUyBuEdMQW2ChyzrN9Wa4B73tu4Iho0QMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCUxHlmBfKU8mEXn9Gb6CiqvN470rNDukwLhsH8IJ25cs2s+T2WMY+Xx+K/FU+2r6 PWsWM16rGucx0Nc742fDtSvNWY1bkV0VUXsF5pfaMbTJnzC0FB4VXwwfk3OsCfrrVs Aes5McW6JYJvBoWjkGtGQNrKdKBRINtBXSrrCueLNNFZzd6m1GyhdBfhN8pvt1oVLz dWFggAnFJp+V6MOO6xFIu638EERhe2JFPZVw8ufLBF2V/0fMA7B289koJ3yAHePmjy LNdt9BUzdzGeognpYEt6DWKuX1Q1Af8Yn0+HYm26nah83C++ezo5x4vFhlYHpufrs9 Ycf6r9GynPcvQ== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Andrew Morton , Bjorn Helgaas , Catalin Marinas , Chen Ridong , Danilo Krummrich , "David S . Miller" , Eric Dumazet , Gabriele Monaco , Greg Kroah-Hartman , Ingo Molnar , Jakub Kicinski , Jens Axboe , Johannes Weiner , Lai Jiangshan , Marco Crivellari , Michal Hocko , Muchun Song , Paolo Abeni , Peter Zijlstra , Phil Auld , "Rafael J . Wysocki" , Roman Gushchin , Shakeel Butt , Simon Horman , Tejun Heo , Thomas Gleixner , Vlastimil Babka , Waiman Long , Will Deacon , cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 32/33] kthread: Document kthread_affine_preferred() Date: Thu, 1 Jan 2026 23:13:57 +0100 Message-ID: <20260101221359.22298-33-frederic@kernel.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20260101221359.22298-1-frederic@kernel.org> References: <20260101221359.22298-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The documentation of this new API has been overlooked during its introduction. Fill the gap. Signed-off-by: Frederic Weisbecker --- kernel/kthread.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/kthread.c b/kernel/kthread.c index 51f419139dea..c50f4c0eabfe 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -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); -- 2.51.1