From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F008EEEC1C for ; Thu, 1 Jan 2026 22:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Is1ybNDhnjEDSsM3I0j9N19K5wdToOdUg+Lflu3Untc=; b=2iVXJgJMDQ9drWtcsvZFfcfqeN y6xwNYj+uBEiip9iWl9r/jrH7R63TOAeDmH6f5CDZDdd3OqVZWpHa358DOFq0XSL2Rfdtyimp2uTX eAid70d1UulVNrGVNxzXZlF1vpWax80NLvh2+7oCc3M4lWPFQ4yTqghZy5dIGYQFVnbMjrc3LdYtm B2ss3JStiaO2l0yjagRE69VCnDGP7aKRnqnSYMcNQgvuTNI7EXr8AWnZaglEAQUiWvzR/dMdPQagI EfgwFFZy4dClUHmOHoIx6BuwIsp8Q15dWgsN91Fe9hdv3qoa/J/suxSD5WYtr3ESLbf9fXb7uG2C8 a/PTqUnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vbQvy-00000007XYj-070i; Thu, 01 Jan 2026 22:14:21 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vbQvv-00000007XYA-3HJs for linux-arm-kernel@lists.infradead.org; Thu, 01 Jan 2026 22:14:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 8160F41A9B; Thu, 1 Jan 2026 22:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D868C4CEF7; Thu, 1 Jan 2026 22:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767305652; bh=TkV0C834LNJT27mx2/Ayl0IxXi3IFIB0xDgB+kxqTGk=; h=From:To:Cc:Subject:Date:From; b=r+AnEX/Uh7pY3+P9PtZZEL/YIDn27sHbkqPtMSwNLRKHHMTms8Iih3doTf696xwnu gEPlpuSiMxK4SXJxo4eSA8HJefbZZhMKsT1EF4NF5ytyce+tbp8wA33QjukE70v5oL UeUMrHshVDmYFFB+rH5otwwzlN8jOnScbiMonmLog0e7JWiUXs7DCJJjEnsGDShFp7 T9eAqXR4tqZeHDiuR8a6MJx6IsPtATcbvcdT4Q6qbs9dBvxv5nSVFssetF1MBcynmq OcDhyEwkROwIlr8GTTga8WovIiNHj94MbaZ+Yc4fvu65j6YAwxQYvgJLR/xHfZNysi Tu6x4WAFW1OMA== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Tejun Heo , Phil Auld , Peter Zijlstra , Lai Jiangshan , Danilo Krummrich , Catalin Marinas , Michal Koutny , netdev@vger.kernel.org, Roman Gushchin , linux-block@vger.kernel.org, Thomas Gleixner , Eric Dumazet , Michal Hocko , Bjorn Helgaas , Ingo Molnar , Chen Ridong , cgroups@vger.kernel.org, linux-pci@vger.kernel.org, Greg Kroah-Hartman , "David S . Miller" , Vlastimil Babka , Marco Crivellari , Andrew Morton , Jens Axboe , "Rafael J . Wysocki" , Johannes Weiner , Simon Horman , Shakeel Butt , linux-mm@kvack.org, Jakub Kicinski , linux-arm-kernel@lists.infradead.org, Gabriele Monaco , Waiman Long , Muchun Song , Will Deacon , Paolo Abeni , Chen Ridong Subject: [PATCH 00/33 v6] cpuset/isolation: Honour kthreads preferred affinity Date: Thu, 1 Jan 2026 23:13:25 +0100 Message-ID: <20260101221359.22298-1-frederic@kernel.org> X-Mailer: git-send-email 2.51.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260101_141415_994775_A37A358D X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, The kthread code was enhanced lately to provide an infrastructure which manages the preferred affinity of unbound kthreads (node or custom cpumask) against housekeeping constraints and CPU hotplug events. One crucial missing piece is cpuset: when an isolated partition is created, deleted, or its CPUs updated, all the unbound kthreads in the top cpuset are affine to _all_ the non-isolated CPUs, possibly breaking their preferred affinity along the way Solve this with performing the kthreads affinity update from cpuset to the kthreads consolidated relevant code instead so that preferred affinities are honoured. The dispatch of the new cpumasks to workqueues and kthreads is performed by housekeeping, as per the nice Tejun's suggestion. As a welcome side effect, HK_TYPE_DOMAIN then integrates both the set from isolcpus= and cpuset isolated partitions. Housekeeping cpumasks are now modifyable with specific synchronization. A big step toward making nohz_full= also mutable through cpuset in the future. Changes since v5: * Add more tags * Fix leaked destroy_work_on_stack() (Zhang Qiao, Waiman Long) * Comment schedule_drain_work() synchronization requirement (Tejun) * s/Revert of/Inverse of (Waiman Long) * Remove housekeeping_update() needless (for now) parameter (Chen Ridong) * Don't propagate housekeeping_update() failures beyond allocations (Waiman Long) * Whitespace cleanup (Waiman Long) git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git kthread/core-v6 HEAD: 811e87ca8a0a1e54eb5f23e71896cb97436cccdc Happy new year, Frederic --- Frederic Weisbecker (33): PCI: Prepare to protect against concurrent isolated cpuset change cpu: Revert "cpu/hotplug: Prevent self deadlock on CPU hot-unplug" memcg: Prepare to protect against concurrent isolated cpuset change mm: vmstat: Prepare to protect against concurrent isolated cpuset change sched/isolation: Save boot defined domain flags cpuset: Convert boot_hk_cpus to use HK_TYPE_DOMAIN_BOOT driver core: cpu: Convert /sys/devices/system/cpu/isolated to use HK_TYPE_DOMAIN_BOOT net: Keep ignoring isolated cpuset change block: Protect against concurrent isolated cpuset change timers/migration: Prevent from lockdep false positive warning cpu: Provide lockdep check for CPU hotplug lock write-held cpuset: Provide lockdep check for cpuset lock held sched/isolation: Convert housekeeping cpumasks to rcu pointers cpuset: Update HK_TYPE_DOMAIN cpumask from cpuset sched/isolation: Flush memcg workqueues on cpuset isolated partition change sched/isolation: Flush vmstat workqueues on cpuset isolated partition change PCI: Flush PCI probe workqueue on cpuset isolated partition change cpuset: Propagate cpuset isolation update to workqueue through housekeeping cpuset: Propagate cpuset isolation update to timers through housekeeping timers/migration: Remove superfluous cpuset isolation test cpuset: Remove cpuset_cpu_is_isolated() sched/isolation: Remove HK_TYPE_TICK test from cpu_is_isolated() PCI: Remove superfluous HK_TYPE_WQ check kthread: Refine naming of affinity related fields kthread: Include unbound kthreads in the managed affinity list kthread: Include kthreadd to the managed affinity list kthread: Rely on HK_TYPE_DOMAIN for preferred affinity management sched: Switch the fallback task allowed cpumask to HK_TYPE_DOMAIN sched/arm64: Move fallback task cpumask to HK_TYPE_DOMAIN kthread: Honour kthreads preferred affinity after cpuset changes kthread: Comment on the purpose and placement of kthread_affine_node() call kthread: Document kthread_affine_preferred() doc: Add housekeeping documentation Documentation/core-api/housekeeping.rst | 111 ++++++++++++++++++++++ Documentation/core-api/index.rst | 1 + arch/arm64/kernel/cpufeature.c | 18 +++- block/blk-mq.c | 6 +- drivers/base/cpu.c | 2 +- drivers/pci/pci-driver.c | 71 ++++++++++---- include/linux/cpu.h | 4 + include/linux/cpuhplock.h | 1 + include/linux/cpuset.h | 8 +- include/linux/kthread.h | 1 + include/linux/memcontrol.h | 4 + include/linux/mmu_context.h | 2 +- include/linux/pci.h | 3 + include/linux/percpu-rwsem.h | 1 + include/linux/sched/isolation.h | 16 +++- include/linux/vmstat.h | 2 + include/linux/workqueue.h | 2 +- init/Kconfig | 1 + kernel/cgroup/cpuset.c | 68 +++++++------- kernel/cpu.c | 42 ++++----- kernel/kthread.c | 160 +++++++++++++++++++++----------- kernel/sched/isolation.c | 141 +++++++++++++++++++++++----- kernel/sched/sched.h | 4 + kernel/time/timer_migration.c | 25 +++-- kernel/workqueue.c | 17 ++-- mm/memcontrol.c | 31 ++++++- mm/vmstat.c | 15 ++- net/core/net-sysfs.c | 2 +- 28 files changed, 557 insertions(+), 202 deletions(-)