From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59E2330BB86 for ; Fri, 6 Feb 2026 07:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361511; cv=none; b=J3Gv2vftfmUiYk1pFlrK+9X7HBeAn3/yeVaZhMJ8/SsmfTr1HsvyCKV0R7yAFq+nbojWfipUUKAmrrj+WEI+MEtLpH3cDig/kQ3RoZ0RPIXy5oBQqFyAISwarJ4ROUNkHuedEhYx1wyvkwlICG6oZsoycMwYoIAsao4uYCi4c2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361511; c=relaxed/simple; bh=cs6CcPjBf3Hhxwg3I/aO+r+GIKGiE678uAuhi86HGrk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GHBIT3O22aE0ILHDwO38Mgztw677ukXOezfvkqC+BFfJslexZPqSJYfVFpxdiOtnEtVfxpCYBaMuJrXSbX1K72QePFLU2GnlBfJZEX24Du/LTsE/dzGuMAGIZa28/1173X+WCUOhifTj8fsyVSYZtVS50FtuCbsNtCZR/acMMEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fGOQDkS6; arc=none smtp.client-ip=74.125.82.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fGOQDkS6" Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-124a635476fso2705777c88.0 for ; Thu, 05 Feb 2026 23:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361510; x=1770966310; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=q3v4q+lvsBn1hE6xrawKSqo/X3eavnWHmOAy67YUdOo=; b=fGOQDkS6ebAdRHYBru5yx5CLGYxpirwFiN9HztTPGh+TPh6jG2pYJCnVqWt+XMUXmL n+qCheDLkCaFRgMQYRvfjY/NqcQt6dO3RjP6itEUh1PLxrcmM5Fv68CYTpnklLmJiqBU MDi5k1ElF0qwvoGyXin3yxF2FmQXK66sR0X9ejrC9hfHsSPowsXmpCTVXi3894YdHUxD jXjqAMTJzP3ZI8/QYBcMnsSJ1f9noEp4EnA1ZCf3w2txkxTsvePeP85tSk0xDsXKzQxl ZLOxK8fuqA7rh2830tIQnx/bBvD+bqiNoc2+EZR2bOe6kIDtWASjLwNsYa2vg8GQa4Mh RDjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361510; x=1770966310; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=q3v4q+lvsBn1hE6xrawKSqo/X3eavnWHmOAy67YUdOo=; b=oGvhe6D9tX0otMQ1k5opR6pivChZgRX/XrUUKc1sogEo3/r1qfZIFhG9Vd+nXgwL/b z/tZPglHZ5TIgfAfTOkHdN98pCB5Au2FXQM6PQvb1879d5gNkAvge5dSqbDfZDR0T2nY 1YXut+5FyysaOvwu/uOHoyF1Jl3rheKYs5OfVCRnXS8E/VtgqKaIuO4Z2vB8NHIjqaD1 otn80C3N37846SV2hy4MOjdq6sHX2hrLZ4dnDwINVdFSTvP+LEgyl9vwzw8HFIgU/spE cGH0Lil+P3Xkz8YMzuTV5CIrSoRLqrOgiQYGgjhxUGu+VEo8foeJt0BtX01O5w1HNWFm AAig== X-Gm-Message-State: AOJu0Ywns46lprqFsH/xkjRNlUwJZby/w2SpnyyzpkfOpBnrRh649601 6RaVXhFblYEXu0g0eVKZu5OiG9EEgmQDfWts8/AfhTI8Hh5zOA0s5WUJ X-Gm-Gg: AZuq6aJ2sTsb6oRG3QMq3DcQJrkBQfZCzQOJF44T1tFPl1YvoVveWac7HkvtvEb7uIn fXZqdZ1Qe+NeL0VNfD6y1YCnty/BKecogH1LN5CdxKjKcfq4X70z8oxgUcnadV07iOIYL0SF4bS EHxPv3LQoE/tpuM9ezH7L4BJugaQE1CXnffBjJw72d1hvvjTPizvudaboi54jrfs0hfFUZ/GWN1 yD7XeMtGVicDTnuCT5sCaZLfZNfp/NcmQdimixP+fa9uR5aB4hbuTnGAhz/tlSQJucDpIaihOo0 GzfYuLe9wLK8mJq30BhD4/cTxTaNmqHc1+IuWVwdL0n58ju9B4E82CZPl9DJifgsbCMYHd2Om1V rpH2E8AaaBXctSV4qGphzFUhhhPLdxSpTfH6Nm31HEOQHvSZcqDuP4Jd4nFaeIlOve4+Q8A0kWV DP2AKAWN5H/67OVD1iEXyg X-Received: by 2002:a05:7022:4a4:b0:11b:9386:a38b with SMTP id a92af1059eb24-127040981efmr964389c88.46.1770361510084; Thu, 05 Feb 2026 23:05:10 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:05:09 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:22 -0500 Subject: [PATCH RFC 01/12] sched/isolation: Remove __init restriction from housekeeping cores Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-1-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 The current housekeeping management logic in kernel/sched/isolation.c is heavily tied to the boot process. Functions like housekeeping_setup() and housekeeping_init() are marked with __init, and they use alloc_bootmem_cpumask_var() for memory allocation. This prevents any runtime reconfiguration of housekeeping masks. Refactor the infrastructure to support dynamic updates: 1. Remove __init markers from core functions to keep them available after boot. 2. Replace bootmem allocation with runtime-safe alloc_cpumask_var() using appropriate GFP flags (GFP_NOWAIT during early boot, GFP_KERNEL at runtime). 3. Introduce housekeeping_mutex to protect the global state during concurrent updates. 4. Update include/linux/sched/isolation.h to reflect function signature changes. This lays the foundation for runtime isolation reconfiguration without requiring a system reboot. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- include/linux/sched/isolation.h | 2 +- kernel/sched/isolation.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolatio= n.h index d8501f4709b5..cecb80b09120 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -31,7 +31,7 @@ extern const struct cpumask *housekeeping_cpumask(enum hk= _type type); extern bool housekeeping_enabled(enum hk_type type); extern void housekeeping_affine(struct task_struct *t, enum hk_type type); extern bool housekeeping_test_cpu(int cpu, enum hk_type type); -extern void __init housekeeping_init(void); +extern void housekeeping_init(void); =20 #else =20 diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 3ad0d6df6a0a..811bf6cbe68d 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -8,6 +8,7 @@ * */ #include +#include #include "sched.h" =20 enum hk_flags { @@ -16,6 +17,7 @@ enum hk_flags { HK_FLAG_KERNEL_NOISE =3D BIT(HK_TYPE_KERNEL_NOISE), }; =20 +static DEFINE_MUTEX(housekeeping_mutex); DEFINE_STATIC_KEY_FALSE(housekeeping_overridden); EXPORT_SYMBOL_GPL(housekeeping_overridden); =20 @@ -84,7 +86,7 @@ bool housekeeping_test_cpu(int cpu, enum hk_type type) } EXPORT_SYMBOL_GPL(housekeeping_test_cpu); =20 -void __init housekeeping_init(void) +void housekeeping_init(void) { enum hk_type type; =20 @@ -102,20 +104,30 @@ void __init housekeeping_init(void) } } =20 -static void __init housekeeping_setup_type(enum hk_type type, +static void housekeeping_setup_type(enum hk_type type, cpumask_var_t housekeeping_staging) { + unsigned int gfp =3D GFP_KERNEL; + + if (system_state < SYSTEM_RUNNING) + gfp =3D GFP_NOWAIT; + + if (!housekeeping.cpumasks[type]) + alloc_cpumask_var(&housekeeping.cpumasks[type], gfp); =20 - alloc_bootmem_cpumask_var(&housekeeping.cpumasks[type]); cpumask_copy(housekeeping.cpumasks[type], housekeeping_staging); } =20 -static int __init housekeeping_setup(char *str, unsigned long flags) +static int housekeeping_setup(char *str, unsigned long flags) { cpumask_var_t non_housekeeping_mask, housekeeping_staging; unsigned int first_cpu; int err =3D 0; + unsigned int gfp =3D GFP_KERNEL; + + if (system_state < SYSTEM_RUNNING) + gfp =3D GFP_NOWAIT; =20 if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERN= EL_NOISE)) { if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) { @@ -125,13 +137,17 @@ static int __init housekeeping_setup(char *str, unsig= ned long flags) } } =20 - alloc_bootmem_cpumask_var(&non_housekeeping_mask); + if (!alloc_cpumask_var(&non_housekeeping_mask, gfp)) + return 0; + if (cpulist_parse(str, non_housekeeping_mask) < 0) { pr_warn("Housekeeping: nohz_full=3D or isolcpus=3D incorrect CPU range\n= "); goto free_non_housekeeping_mask; } =20 - alloc_bootmem_cpumask_var(&housekeeping_staging); + if (!alloc_cpumask_var(&housekeeping_staging, gfp)) + goto free_non_housekeeping_mask; + cpumask_andnot(housekeeping_staging, cpu_possible_mask, non_housekeeping_mask); =20 @@ -203,9 +219,9 @@ static int __init housekeeping_setup(char *str, unsigne= d long flags) err =3D 1; =20 free_housekeeping_staging: - free_bootmem_cpumask_var(housekeeping_staging); + free_cpumask_var(housekeeping_staging); free_non_housekeeping_mask: - free_bootmem_cpumask_var(non_housekeeping_mask); + free_cpumask_var(non_housekeeping_mask); =20 return err; } --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B862E30AD06 for ; Fri, 6 Feb 2026 07:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361519; cv=none; b=KgLCmqjeLW5+hri/SI8Q2N5PWS/5DHTgokimYOz3GDZZIz1r5gT5NaA3YhApu2fji0LkHCIVz5T2yQGXDM4RVs9i0Pld5RaLuqyrowLU0JAiEBOChBeUOpkb6rvk8v13GovuCqY6VztL6pjqTo9CCECQV/H49AELSilCRfRdhIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361519; c=relaxed/simple; bh=n0omYtl0xIEte7JAbbG8OBLHZ+FrvgEEEjgJhdigEL8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FKxzWShWFVNt0+JU6o9yYgrC+jIPm9z9shHhZ8svn/2KV1kIpBdHH8szCsAFhfIoyLMExr7rBURUs1nRWCad0i1tCujx1pQnufxQRD5ZFywvWICZaEhB04ZxtZrv8R+AchyUblt3qH5FHg+/2gNYQHGkvvcidHmwCdBpcgw/0sQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OKcEwFIu; arc=none smtp.client-ip=74.125.82.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OKcEwFIu" Received: by mail-dl1-f46.google.com with SMTP id a92af1059eb24-124566b6693so975113c88.0 for ; Thu, 05 Feb 2026 23:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361519; x=1770966319; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pOd/UWGDzn8jr9iF17p1rTKmc8F1m4wqgpJ+mmp6cko=; b=OKcEwFIun//Ar3ia//9lf13140nKTqJFHEYCZRZlQVLMad4Nq/ql8BTBrDZuQqJa/8 Z9gE/rFSn4+9JSqVJLMNq7b+PPels43W01C6jCMgSR11X4cZBYluFqLPCFD9G1KRHTsT D3NM+ESJFo1DMlKg/Bzm3A64kSX+CwiwYQVt1oMQA4jRYsEcKDTQ/rdMq4OWn0oQCMUW VGev0tAtFw2tkG5Kjzu1HvL0B8AHKaFSdEcbBE17s9h+wFUh3V5h7gSzL8l1TGeOp8Wg hMBVT5lNPI9IQuHMtK2Dly80Kl4v8u75tuf1e73/rlt098fls0dsGfnO6OSN6UP5/uyx 0p1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361519; x=1770966319; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=pOd/UWGDzn8jr9iF17p1rTKmc8F1m4wqgpJ+mmp6cko=; b=D7mSm3A61PnbfHat3Aq1E4uEeCYuU1B4Uq6GoZ1iVU3uEgiv7AJIXVDwm/nP3qXEpN 2l/idi1GhHaNjkAkUk1FCgPboeaM5NWAVNMkXAOKsTvyTvBEqOZb/rzPpb+9curDbX7P LUBtPz5Nhgr1rlnlFdrBGraVjf7opYTvVeL+IlidCPdmEnYvLSZoA0xcVZimItEMMGkc G3+e5QDxzn0pBqtx9Tx+YI24lu84ZojmDO24sUD5TeUs45XH7+trgLaxfYI+AeEFzkn/ wBEmGbLGFSTKUWuVjP/WRXzS4CDEtQ21mhY4layI9LOYsh8rAH/ZD6LaInj1yKi7ne9K AOlQ== X-Gm-Message-State: AOJu0Yy8E6b2VdLhB+Rs6F7Mu3V5AsjQ/ovRcHDBoHGnJvOvMZaaAXlb 6ENWNHibci4biQS/nrgWVj0jATIHqchbiw09ZabpKLvL1EZ/JOEPwUEh X-Gm-Gg: AZuq6aJN7bUX0a0nJC6xB+VzuuooAcWYVaQes4GLhK2WyW30sVny3hlcd/LyXXgHk6P GsZPFuIGNyzs/5igXwotDhL4Tkt+ZKS+Lim6QNzPANblySWQYi4VD8ZMhiGzCU8SNdeezVG7mEO 4yryV5bqnHVyK/xE3BreAT7akDCcU6k6XZeKMBNELDlvAodrhJcPth3PBXERmWppcHt3u3yWH0f x2CwCfHNrH0AgRzs0v8N1RWMPhGk7SdHJKnICEThSE6si7Yh0ZWM8cCyE/ljnr8lva1OfHawVTk f+izDnUCwIi3mEkRe5bAkB4QICRiOq7QyvXWlCz1YFXqvKL3YMvyPIHIM86gw1R0YMKGomx0ah7 VQ69nKG2Y1x1b9KGQk8IHiC3jWekdVvfXEiDPucW5y8nL+VabZjOSkQpARxlap0NYcwIqYkJt6h Q/YUtTmSTPN7Co2e5pqe/+ X-Received: by 2002:a05:7022:492:b0:119:e569:f262 with SMTP id a92af1059eb24-12703ff13cemr1009542c88.11.1770361518689; Thu, 05 Feb 2026 23:05:18 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:05:18 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:23 -0500 Subject: [PATCH RFC 02/12] sched/isolation: Introduce reconfiguration notifier chain Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-2-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Introduce a blocking notifier chain for housekeeping to support dynamic reconfiguration of masks. Subsystems like RCU, Timers, and IRQ management need to be notified when the isolation state of a CPU changes at runtime. 1. Define 'struct housekeeping_update' and 'HK_UPDATE_MASK' in isolation.h to pass update event details (type of housekeeping and the new mask). 2. Implement housekeeping_register_notifier() and housekeeping_unregister_notifier() to allow subsystems to subscribe to updates. 3. Provide an internal housekeeping_update_notify() helper to trigger the chain. This signaling mechanism enables other kernel subsystems to adapt their internal state (e.g., migrating kthreads or timers) dynamically when housekeeping masks are modified via upcoming sysfs interfaces. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- include/linux/sched/isolation.h | 20 ++++++++++++++++++++ kernel/sched/isolation.c | 23 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolatio= n.h index cecb80b09120..5c07e3e9b8d1 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -5,6 +5,7 @@ #include #include #include +#include =20 enum hk_type { HK_TYPE_DOMAIN, @@ -24,6 +25,13 @@ enum hk_type { HK_TYPE_KTHREAD =3D HK_TYPE_KERNEL_NOISE }; =20 +struct housekeeping_update { + enum hk_type type; + const struct cpumask *new_mask; +}; + +#define HK_UPDATE_MASK 0x01 + #ifdef CONFIG_CPU_ISOLATION DECLARE_STATIC_KEY_FALSE(housekeeping_overridden); extern int housekeeping_any_cpu(enum hk_type type); @@ -32,6 +40,8 @@ extern bool housekeeping_enabled(enum hk_type type); extern void housekeeping_affine(struct task_struct *t, enum hk_type type); extern bool housekeeping_test_cpu(int cpu, enum hk_type type); extern void housekeeping_init(void); +extern int housekeeping_register_notifier(struct notifier_block *nb); +extern int housekeeping_unregister_notifier(struct notifier_block *nb); =20 #else =20 @@ -59,6 +69,16 @@ static inline bool housekeeping_test_cpu(int cpu, enum h= k_type type) } =20 static inline void housekeeping_init(void) { } + +static inline int housekeeping_register_notifier(struct notifier_block *nb) +{ + return 0; +} + +static inline int housekeeping_unregister_notifier(struct notifier_block *= nb) +{ + return 0; +} #endif /* CONFIG_CPU_ISOLATION */ =20 static inline bool housekeeping_cpu(int cpu, enum hk_type type) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 811bf6cbe68d..97cc41626a33 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -18,6 +18,7 @@ enum hk_flags { }; =20 static DEFINE_MUTEX(housekeeping_mutex); +static BLOCKING_NOTIFIER_HEAD(housekeeping_notifier_list); DEFINE_STATIC_KEY_FALSE(housekeeping_overridden); EXPORT_SYMBOL_GPL(housekeeping_overridden); =20 @@ -86,6 +87,28 @@ bool housekeeping_test_cpu(int cpu, enum hk_type type) } EXPORT_SYMBOL_GPL(housekeeping_test_cpu); =20 +int housekeeping_register_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&housekeeping_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(housekeeping_register_notifier); + +int housekeeping_unregister_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&housekeeping_notifier_list, nb= ); +} +EXPORT_SYMBOL_GPL(housekeeping_unregister_notifier); + +static int __maybe_unused housekeeping_update_notify(enum hk_type type, co= nst struct cpumask *new_mask) +{ + struct housekeeping_update update =3D { + .type =3D type, + .new_mask =3D new_mask, + }; + + return blocking_notifier_call_chain(&housekeeping_notifier_list, HK_UPDAT= E_MASK, &update); +} + void housekeeping_init(void) { enum hk_type type; --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA688302756 for ; Fri, 6 Feb 2026 07:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361528; cv=none; b=F3m12jgGqzWR3MhRvAhNzugTf+v1y3xqcL1CCrY63aQNxPBB6d13F6PFjzlOLGoIY+4glvakKQ75HsQpdvydMlRKs433UyCZd5W+RRsGrlaFc/miaXbnb12qLF9HyLU/Q2E3+zc3GXD4DvpBzgnJ7+cG1GOH+hUYyl0qmLdYfQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361528; c=relaxed/simple; bh=jQlgM95JazGPee4Uxm5VsMs1dWBVBeceOIcoQGdsSOo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iLa6AS64awHznPBZS5XF1iTOEd/8Nfs2Q+PAGOe7Q/0f+lWMEQCFisUT5o/RBRgMzz2Bd4AMouWC99aIrYtzgZlvV9GgqcuVoM7J5uA4C+ke+h7IsWYHSEsI+0WfpKnmCZHBvP56yL1t+d33o325mPIXd56mVuayZs1o6OkvwM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H+YHvZZ+; arc=none smtp.client-ip=74.125.82.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H+YHvZZ+" Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-126ea4e9694so2636698c88.1 for ; Thu, 05 Feb 2026 23:05:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361527; x=1770966327; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5YEyu0s9ArePSjQ+ivxTOHvq670EsiUwyYwwidqduHM=; b=H+YHvZZ+kjA0FqfemVYPcHFHGxGaoA+zs7ULeKkfe4V5gCGu35Trnz5OVnRo68V2Hv hVMB9RzqLX02PvgAlIKu4QpmNwLJh452HTFlRAnnY5NIaxOFx6OMDrSfz21MbF2yQnTj qIMenKih62LfgEc6chQJeZKxwwY3ov16Q801tnkxw/Z5b9RaKDwwvR5zEPAah5OZN1os a9MJivXtUvmkw8dtFTkuKLBKp3xPF5HDpEjD+HoZR0nb79CXN4qQq5geWh69se8mJylk yDDticJ+CmHkEsYULIgeC/K2dFufKxEDvvnPqaJWk4BFyP2fG0tkS2Qb2xSiK7e2S3F1 p7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361527; x=1770966327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5YEyu0s9ArePSjQ+ivxTOHvq670EsiUwyYwwidqduHM=; b=SJxnK6d9N/3nER03Hg6M7cwgJIEvoaA4/+lU80dkXCA14SgpGRpzb3P7I2AJtthXWR dxZxjfK1yNBmIe+o6hxeVF2cc3QBMqWPZK7jKtJF0HvNrtNkspYjdE4KEbNpzVNoEVWb y7XMsv6cA9LxyI44qe9tvsQyVhhG7hUyIATN3ikG3A4c3vNLEtuKB62bqtHg53UAWInz /7Skrt2PSWzp6Dr+1sZdt7o9GnUOO7narhi57echY/DokPq036qgRLyJj5qR5SQ8KNSJ VVpq3Fl4e6deVRhLK6SL3LNbB2QOc/4BqcYKMDefnvTro8vmXMJWAh4xvNiCYZs7f1NQ JbEw== X-Gm-Message-State: AOJu0Ywax8bnTSmqEM2nciH6L94Dc8L1ai0vKSNDvMv7BO0SIQjK+yGQ 4M2dRlJWavXzdN4S+fwcOcWgf0fpAvWVIeJDqp/ebEXavp0qsyR3+qJN X-Gm-Gg: AZuq6aIoeJeG6oL5hOQl8vwXj1ru7MMcwtkNldCuIDDzGEL08dJsoTa/BrDYUxYgjhC VlzJymAVSoc21dmWvaMuq3OD9A3b0AO7yrSfh6wh1oW7yvFI4o+wZQLErWJtw7BduI7LW80x2Dj EgQl0fwnP8OXwF3hms1NqoIZH1bz3ndvr4pvWyxo4+o9/LKgq9Hcu3fKZR5DtaHWNcSsFCTI3Ym PP9qp6kOhszOZ43ygzMZxgYczyQnXCVV2luqtHACjcDsxPfdrgnE+oO+9h/lN5Xwm4Js0JZSjSK VA+1lWwXlm3En6Bz0c9+L+59znh5h475XLxkYDMEvoM2tbcgmWvkVzC7YpCHCGr3TaITl5g751C 16kZWMPEvJzjf/zwEw3UbdDBnAONi48C61X9Xe3GuFEX39Ak2hdWmhq02FioJ+9bCRF49D2Kdu/ pdWutzXGe6aQ== X-Received: by 2002:a05:7022:222a:b0:11b:9386:825c with SMTP id a92af1059eb24-1270402ea16mr1071439c88.41.1770361526887; Thu, 05 Feb 2026 23:05:26 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:05:26 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:24 -0500 Subject: [PATCH RFC 03/12] genirq: Implement dynamic migration for Managed IRQs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-3-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Support dynamic reconfiguration of CPU isolation by making the managed interrupts responsive to housekeeping mask changes at runtime. 1. Register a housekeeping notifier in the genirq subsystem to listen for HK_TYPE_MANAGED_IRQ updates. 2. Iterate through all active interrupts when a mask update occurs. 3. Re-apply affinity for managed interrupts to ensure they honor the newly configured housekeeping mask. 4. Use irq_set_affinity_locked() to trigger migration away from newly isolated CPUs or towards newly designated housekeeping CPUs. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/irq/manage.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++= +++ 1 file changed, 52 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 349ae7979da0..9523f0655b12 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #include "internals.h" =20 @@ -2811,3 +2812,54 @@ bool irq_check_status_bit(unsigned int irq, unsigned= int bitmask) return res; } EXPORT_SYMBOL_GPL(irq_check_status_bit); + +#ifdef CONFIG_SMP +static int irq_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct housekeeping_update *upd =3D data; + struct irq_desc *desc; + unsigned int irq; + + if (action !=3D HK_UPDATE_MASK || upd->type !=3D HK_TYPE_MANAGED_IRQ) + return NOTIFY_OK; + + irq_lock_sparse(); + for_each_active_irq(irq) { + struct irq_data *id; + + desc =3D irq_to_desc(irq); + if (!desc) + continue; + + scoped_guard(raw_spinlock_irqsave, &desc->lock) { + id =3D irq_desc_get_irq_data(desc); + if (!irqd_affinity_is_managed(id) || !desc->action || + !irq_data_get_irq_chip(id)) + continue; + + /* + * Re-apply existing affinity to honor the new + * housekeeping mask via __irq_set_affinity() logic. + */ + irq_set_affinity_locked(id, irq_data_get_affinity_mask(id), false); + } + } + irq_unlock_sparse(); + + return NOTIFY_OK; +} + +static struct notifier_block irq_housekeeping_nb =3D { + .notifier_call =3D irq_housekeeping_reconfigure, +}; + +static int __init irq_init_housekeeping_notifier(void) +{ + housekeeping_register_notifier(&irq_housekeeping_nb); + return 0; +} +core_initcall(irq_init_housekeeping_notifier); +#endif + + --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA33D30AD06 for ; Fri, 6 Feb 2026 07:05:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361547; cv=none; b=YLtvXPo8LzHWY+6gcSErc3K7bWMf+JlDDAYEWwzdepg/JJDXLfkNtV/vyYJr3wn4C2UfMtLAWrFB4MRqf4Knrl0RAU+aqIaad0j9QhHSth7ONt3+f3U6/9VdYxJOfTMxEyizXv93itT5a8Hqtbg8Y2pF0ocJl4KEb+xFLD/7EEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361547; c=relaxed/simple; bh=dJwZORxnoofLuqT7+FiHTuSwB9Z/aRfTx02GaGOnLfw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lrTELLzzZUta/lJJ+Vwws5d3vyZgkprFXbNfGQgBDgdDE54pGPl/FERge4wW8WtnwlFIdxs5BaJa607piqQB4r9FB0CyAqXzMMw+iuHP6mzfp3zbon/lYLu/BMft5YLppUcqlXBMrvSxJ/zTqOd4i0l8/r1ocyqpvh1DLyCHZTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Sbkp29re; arc=none smtp.client-ip=74.125.82.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sbkp29re" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1248d27f2b9so2079815c88.0 for ; Thu, 05 Feb 2026 23:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361547; x=1770966347; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3PaHf4BGcLmB1AiF1WHcrlMYrEJBUdJoTjVBNhvu80E=; b=Sbkp29reTtdTko619Uhh9jv6UqZKQPIrLaZbRsi584JKtHTbMobAn0+OPV98nqN7ZA vbexgNMJKxGte+YgVZs7mnFtQ5ty9T4WYC1++dmL2btCO92aCsyveH5S1VClkcjnc3Hs JsaTBRlYpCQ1IxCj86282YJ3HckFWBUFVFEiMZx5g7mh3Zb+Rh+++loWkk76Q/Ac+//T Oraz2Cete6yFRh2kgwDsshlaY+c7c7n0Ano8CHLj0k0YyUr/G3FZv3VVKPuMMUbTycfC tcxsm3hWU9CwQjH+Pm91nUdSp6+JaqkuLt4KMQxexFlmtl/otdev3iQk+eJ3QbGTf8CO PKyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361547; x=1770966347; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=3PaHf4BGcLmB1AiF1WHcrlMYrEJBUdJoTjVBNhvu80E=; b=exXChjYPO5i3ovbuVCdX1S4Dlsi9BK8zvZ6gnqIhvSSJzM5V+Lw23WQs4NFbN5JPrf SsMUFdoF/SypmOONVd+xIjefcF98Hov1elyvzIa/bTawm4Uy+6cGl30JsAv7RSC3jLJm 8lX4bgDdCLn513WxhFMmJeE+hmFaIQK3arguSDHN8noORLIrDVKUqOePspweUnQv2uRU dpFYK9MUgWkHqXulRqeCShMJzD12qBAb9DaT52OPX77lZzIAH79PF+DldnOs6j+m/cCw AQU6roFwcPvEO5J/KF9Njsk9BFRuta7PceNZbMKcMIMH6Jpn6n3javwLlSgWy+kfHNou ge6g== X-Gm-Message-State: AOJu0YxNmGtICCvIn8WmT3HrKfzKK9n7UTjzwEv0J7MxYY62FGWelZYJ cT47+LpKgBwPtVJca1bYMd/zQboUHaV7ntd2ZEEw66KU1R7mDWHtmTT5 X-Gm-Gg: AZuq6aI5tV7zWUMsrWMoTJLAcan8DLrG/lJdEgah3O04XnosLoKJzogS47PoHIPoVhK Z/zGw749nfyy/8eZ7vYSkBB7DEbRaIrjP1V/jUxKsyO2gkOu6fa6VZ5hKUjRoZSVPNgiMxzoaPT nES1bzH+HU37CXW1X7AwNqExEIRx2eDMOHeThGGhjGmiaAtKb0bKI27KdovrvK+qso367Ttsyir LTMPOZPSmWXD0A89/agczeSOjEJgbxaFXdYZBZ4dAgUmK8vB5ZTZejGa/XPx3Qx1EWOen6o9y58 a6RTfF4RG97XEaBbMvQt9Q3i/hWx6W40jKFELWpgX8re2QOnQ8hbL2K1LJnkJMv9I+8MZZ8WfTk z9tjG2v3ITNCCbOySipfshDMJgVdHjdvu96qdU7/KDxgalgkEHxi9k+MPofc4hdtECxY0sLBUW+ ZPl2AamWjI1Q== X-Received: by 2002:a05:7022:222a:b0:11b:9386:a380 with SMTP id a92af1059eb24-12704030436mr735238c88.47.1770361546880; Thu, 05 Feb 2026 23:05:46 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:05:46 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:25 -0500 Subject: [PATCH RFC 04/12] rcu: Sync RCU housekeeping mask on notification Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-4-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 When the housekeeping CPU mask for RCU is updated at runtime, RCU grace-period kthreads and tasks-RCU kthreads should be migrated to the newly designated housekeeping CPUs. 1. Implement rcu_housekeeping_reconfigure() to handle HK_UPDATE_MASK events for HK_TYPE_RCU. 2. Update the affinity of rcu_state.gp_kthread when the mask changes. 3. Register the RCU housekeeping notifier during late initialization. This ensures RCU kthreads honor dynamic isolation settings without requiring a system reboot. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/rcu/tree.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 293bbd9ac3f4..ec496e4bd24f 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -4913,7 +4914,49 @@ void __init rcu_init(void) tasks_cblist_init_generic(); } =20 +#ifdef CONFIG_SMP +static int rcu_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct housekeeping_update *upd =3D data; + struct task_struct *t; + + if (action !=3D HK_UPDATE_MASK || upd->type !=3D HK_TYPE_RCU) + return NOTIFY_OK; + + t =3D READ_ONCE(rcu_state.gp_kthread); + if (t) + housekeeping_affine(t, HK_TYPE_RCU); + +#ifdef CONFIG_TASKS_RCU + t =3D get_rcu_tasks_gp_kthread(); + if (t) + housekeeping_affine(t, HK_TYPE_RCU); +#endif + +#ifdef CONFIG_TASKS_RUDE_RCU + t =3D get_rcu_tasks_rude_gp_kthread(); + if (t) + housekeeping_affine(t, HK_TYPE_RCU); +#endif + + return NOTIFY_OK; +} + +static struct notifier_block rcu_housekeeping_nb =3D { + .notifier_call =3D rcu_housekeeping_reconfigure, +}; + +static int __init rcu_init_housekeeping_notifier(void) +{ + housekeeping_register_notifier(&rcu_housekeeping_nb); + return 0; +} +late_initcall(rcu_init_housekeeping_notifier); +#endif + #include "tree_stall.h" #include "tree_exp.h" #include "tree_nocb.h" #include "tree_plugin.h" + --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17EA0302756 for ; Fri, 6 Feb 2026 07:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361557; cv=none; b=Ck3YPkF0zw3CFbC0ekHeRP96sROXXDqzlEBAZuoRqMsvtF3wC2SXmzPKD1w5JnjCCszMAvHX1aXJzoCLwkXfXV0KIWvsnRqRixLZeK2yVui+fg0r/lWznAxelrxloQLE2vuEeOqRthXNghIv1HSBJqIeAM9jP8ygrMsZIhjwIBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361557; c=relaxed/simple; bh=ffNi/OfZqfCh3eY/Rf+kiDJpyM0ZNd1ZaRFXcbtbeuk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=savaMu5Qp4HCwosHVfnTzOVqppLQ/Opstnc4oKVu2Dv7JHpCqJ7Igg5e4Qcu4TU5yt52F17+SpvHej5QuX2l5Lu6xjg22qBeFKGTA9NtGSY+xatlORe7qA/qxVU4Y4HDi4HJOZ/ZvrZdorlsFdj6WIsGoGb8jKXK17TYL5uLWbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PKe7OpWV; arc=none smtp.client-ip=74.125.82.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PKe7OpWV" Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-124b117776fso1070712c88.0 for ; Thu, 05 Feb 2026 23:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361556; x=1770966356; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IB2/ruY1e1gP0SuPgYbrsKSnwM+7BBdQPj97g55uYUE=; b=PKe7OpWV6H11crVVO96cIwvAdJShjd5AGfJAPI+rXPSsgShea9vP9Xz6njLyTcq3UG BziXZr7EHd1hOto3OmgRa8Xb7PN+uk5tEOMG1jlU9R8sZ1qjPSjCm+uROIXFKZqQ0NVa Yg5JaNZj5NEB+ijNiMyOMmE28m23vcSjllu84ctjwvK7jwPi+YVFkASx9QKSjXY+WRJu uttnbMaBc1qM7+Ei009sJ3/QDaIXeLB4GEENT+GkxD8gF6dCl68AaLsDgrsYyEg2/vMF DbmtdhY0qQRqAGl9mxn2RRsB3WjnYdwD40hpw8/LAM2xh0RWG7B9u4iiYjbUYNO7okWk Oxgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361556; x=1770966356; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=IB2/ruY1e1gP0SuPgYbrsKSnwM+7BBdQPj97g55uYUE=; b=DTZx3/f6sTMJtCZWkv56nnu76X8S2U0G1113yJpmd4wdNB0gMkWLPnT33c8ks49QSN /UoUHbw5qQIY6pvwrjsDohAG81eLCbroJLlpDCrcP5d8OHFbDHhTJu9/xi1PCwscEGhC mvU8KJ6D9FP4hbWKqN+s7tItdT2hf+H0lzn6jjNosnGTp5uO7boJvWWvlASR0zphATSL iTM5JRVaLUn5qTejs0WB97pliYp+XyjYefREkpfn7Pp3/4li8Nd127/ZZCZiVGYIZAZ6 L4fWx85L8IApBOy87WMqncxChNvTJch3ZY6WINpmGLoJqqTM+LzTmVpMmXi8oL8VGA+x VK8Q== X-Gm-Message-State: AOJu0YyV74zZWvlBVwVQ7MBbXMAdGg+eYHJNgtPejf59mYr9Lus1m1aj b4Uys4C6NctkNrRQPXuDQTqcGnYOQuMkPMcwL/rkFQErqdVOsq7bTXrs X-Gm-Gg: AZuq6aJmAZvcL3/krxd7sFfu1JyfY6SLuW3zpa1aJ+iy3ByFieE5OksxT2Vm6aVJG6V BJOWVTwTjRGVUyVzxJm0+trHN2JmVRMLdExNQcxxmVmDoSECoRIwUqOABa2DeWbFhYG+UWKHKt8 1f45o65xkYvV48hpiy4gqh/zMxamrv5HyiMFG0IxPXjyxUFMMtqQgoEVN+XCSqXSYJf3gQAq0nQ mOeOfAMZiYTG6GiTWseftv6bSwLzVfQZDVh61Zdq6taqTBN/htgz90OPaLIZr2llPPVGrf0Bhi1 rPlCiTmbvDLal6CN/0Hy6gBQd7FgAoGiBVOSV8Pz+m2VkksJT9xmRWXRghVIFcmtM9YgZRlL8EZ OrUBe/8S2SIEJdKkGwEDWvmUlc72LxeWAq7TtyatB2HdqHSKCk8F/9y2BjpSnB9j5F5Se4pYSqx JeJsDR9MA+Cg== X-Received: by 2002:a05:7022:4a4:b0:11e:3e9:3e9e with SMTP id a92af1059eb24-12704074edfmr999273c88.49.1770361556050; Thu, 05 Feb 2026 23:05:56 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:05:55 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:26 -0500 Subject: [PATCH RFC 05/12] sched/core: Dynamic update housekeeping_cpumask(HK_TYPE_DOMAIN) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-5-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 The housekeeping mask for scheduler domains (HK_TYPE_DOMAIN) is used to determine which CPUs are isolated from the general scheduler load balancing. When this mask is updated at runtime, we need to rebuild the scheduler domains to reflect the new isolation boundaries. Register a housekeeping notifier in the scheduler core to trigger rebuild_sched_domains() when the HK_TYPE_DOMAIN mask changes. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/sched/topology.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index cf643a5ddedd..7f218fc62183 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -4,6 +4,7 @@ */ =20 #include +#include #include #include "sched.h" =20 @@ -2940,3 +2941,28 @@ void partition_sched_domains(int ndoms_new, cpumask_= var_t doms_new[], partition_sched_domains_locked(ndoms_new, doms_new, dattr_new); sched_domains_mutex_unlock(); } + +static int sched_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + if (action =3D=3D HK_UPDATE_MASK) { + unsigned int type =3D (unsigned long)data; + + if (type =3D=3D HK_TYPE_DOMAIN) + rebuild_sched_domains(); + } + + return NOTIFY_OK; +} + +static struct notifier_block sched_housekeeping_nb =3D { + .notifier_call =3D sched_housekeeping_reconfigure, +}; + +static int __init sched_housekeeping_init(void) +{ + housekeeping_register_notifier(&sched_housekeeping_nb); + return 0; +} +core_initcall(sched_housekeeping_init); + --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f53.google.com (mail-dl1-f53.google.com [74.125.82.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A08EC30AACF for ; Fri, 6 Feb 2026 07:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361565; cv=none; b=lynXEJiMHL0TecZHeDYpRJ8nOk57ThqXIRc5WDPZjxr2TKsYwGT6Nr2gFktXG3XLtsenPcu9257UfkvPDPPJ1WmLr3u7Sa7lJPZXfPk/uwZSpiJ4TihyNTS6PXH5x28LpJtrN83Fq4jYRKUY+5YH2CPdIZSiY9xexP6nCL+Alxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361565; c=relaxed/simple; bh=tKwD7qZPuORYanqCCrKMgXQf9MbzZVnLfxvUTl58kmQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iD+4cv+BVq+jMRnYg5wt2o7OXXnlwm1QEATDKNLeQGQNu3IiLO2gGml0aj7za6GBF44iFvEaRkQlN60tavSCobKAW06OIegZclEcWj5S1/ChuoBS6U3aEljx9cM2xL7RrlxnJgCqatnACl1iNS61ooYVawb+RTZWvWCj6AVKDFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PkkVhdfk; arc=none smtp.client-ip=74.125.82.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PkkVhdfk" Received: by mail-dl1-f53.google.com with SMTP id a92af1059eb24-124566b6693so976664c88.0 for ; Thu, 05 Feb 2026 23:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361565; x=1770966365; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BX9sMLwwZBpxhdeadTLxD2L+ATZYvXDyrtJH+GXz33A=; b=PkkVhdfkETCDWRf5XDCJsQLAHWp7ttHONZsKz90x1XM12xlxSYsRKEEReePcfqV7WV 1X8/t0eJ8bmIJaDm3yGFjjc2lyLveetZM43z0qufNerLPhH07gf46ZCyuuWqlcd4wWxv cisMFoOsoHeBtPlj72Z2HiLfWX6wZ2kd7NwpInWR2MyKqA8T8Ejrdplro7l1KAbt6ti+ yS3l/uiOhTyIIc+k+V1Hew9PixsbfWGiO/NY+3mKH1spStzp586c+u8hReHrWeAFnGf+ uS2T1cfWgZ6G0JZXcJukgqDRwmfEIb0fS9z/31B/KVB+J2qCObvS3Fbdyorjm4unCloP lZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361565; x=1770966365; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=BX9sMLwwZBpxhdeadTLxD2L+ATZYvXDyrtJH+GXz33A=; b=eRhOJFeQ84EehTDDeRuvBHfpoITdLyP5FQH81yhv8jXzoTMDe6cgHSINSoitT3Rf5R jd/vUioVTvv3H1OLcETMLo6s0QGf0svCG3VExjNIOb6bObqfFpnpNJOTKWxA9k6l4KpY dK7INtiIApLlYdhd91J6oahipFuS9nYd7DkYEyC66wIR29Z/TzchPt7qYIsv0JkJDME+ BV2xjktKOpIWFDXWUHLyhAn6Kyb5qM+FzL2I57kyqWeehCfdQoq74bMFyN936JAT17NR agTgrtxndjyhkecNzv7kxLC6KazIO0bmkRIkaJSgNPfhBYTOgH4i69fhOM95BvcrxdVu T+CA== X-Gm-Message-State: AOJu0YxGqbIxBxegudvBysQn0jfleBrKayX/+F/uvtQpNoTHwtmGiNIC eoTGE6noNu7+cccfr16MbWd4cnDIe4gGGDaxNqRpWfZp94cka3Y6Mein X-Gm-Gg: AZuq6aI5sOjJjmsz9HGAfNSY4a1BWbxLbTDZrxX6tQ7ga+uY3u6iBD8CdAEEcTJYCs3 9gBCqmHdgsNrj9XnaZ+CjF/fJw7SAbZFr5lM2dNYyEIv+/6deT/Edv5RHFUzaXse0ZRuEzIvuHO /0z5bvQkFSiYMYkE//3icaE+hKyi9Dl1qdRR5vcUlczAe/4z/PCSQBvzL32Ea6ldkgXMOPA1Fhq qbLlvkHGeQr8jTzu44AxXdciBLbDogZB9VMQQKv9kSN1NiWxriRnJyxA5lsBZD8Jmi2VV8ygwDg g4Nc+eARb67xX2X/UeYj+hMdC+r782qOG5WEx2N0AXToTK9Tz5tdcxAjy/krdc2SCuKhAVY9EXB 1gr/m/GuaJIIaV/6aJYU7+IeKALFhH0MHptDoF6SrKBS2RUhkHG7w13EsBTG9PhZucPUBDyOt0M fahg89xgyDzQ== X-Received: by 2002:a05:7022:619e:b0:11d:f890:6751 with SMTP id a92af1059eb24-12703fd8b47mr1055311c88.10.1770361564656; Thu, 05 Feb 2026 23:06:04 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:04 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:27 -0500 Subject: [PATCH RFC 06/12] watchdog: Allow runtime toggle of hardlockup detector on CPUs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-6-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 The lockup detector (watchdog) affinity is initially set based on the HK_TYPE_TIMER housekeeping mask. However, if this mask is updated at runtime, the watchdog threads remain on their original CPUs. Register a housekeeping notifier to update watchdog_cpumask and trigger a reconfiguration via proc_watchdog_update() when the HK_TYPE_TIMER housekeeping mask changes. This ensures that watchdog threads are synchronized with the new isolation boundaries. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/watchdog.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 366122f4a0f8..2922d7f93d61 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -26,6 +26,7 @@ #include #include #include +#include =20 #include #include @@ -1359,6 +1360,28 @@ static int __init lockup_detector_check(void) } late_initcall_sync(lockup_detector_check); =20 +static int watchdog_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + if (action =3D=3D HK_UPDATE_MASK) { + unsigned int type =3D (unsigned long)data; + + if (type =3D=3D HK_TYPE_TIMER) { + mutex_lock(&watchdog_mutex); + cpumask_copy(&watchdog_cpumask, + housekeeping_cpumask(HK_TYPE_TIMER)); + proc_watchdog_update(false); + mutex_unlock(&watchdog_mutex); + } + } + + return NOTIFY_OK; +} + +static struct notifier_block watchdog_housekeeping_nb =3D { + .notifier_call =3D watchdog_housekeeping_reconfigure, +}; + void __init lockup_detector_init(void) { if (tick_nohz_full_enabled()) @@ -1373,4 +1396,5 @@ void __init lockup_detector_init(void) allow_lockup_detector_init_retry =3D true; =20 lockup_detector_setup(); + housekeeping_register_notifier(&watchdog_housekeeping_nb); } --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4548F1A2C0B for ; Fri, 6 Feb 2026 07:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361574; cv=none; b=WPJKYMbsU86sCx5J3vH9QKl+8ywJNU60kiJkxFCPIBxkvz/13VMTgz8YZwGYjdwaXwiC4uXd/da1lEeciDxeOXjU8rRoFZGw6Go3rSSqnN+hBdA5bUaO18MqcYIEJxaf74our6Jty7iIRJJgkLXIMXHtuIMl5Rk3CakQptGazco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361574; c=relaxed/simple; bh=6a04V02JrKq+UtMy+kud93gsZRYKV/Lla4DLD0k2cqg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=akstIIUiNDXHwybPWMspayFiNxYDMeM7OzEprv4xL5W2PKgHDKYzoB2jo/6HNG7SSThpqAwjQUMsRsvRg6Wk5uuMZRMIR5oi9cT5abgoCAjHdwR3eAjVPhdSD0ss4vjnSdTUXLnH8x+uCLE07Ducgv1+/tCFZG3n1rsgrqtpVag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LSkBqR2e; arc=none smtp.client-ip=74.125.82.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LSkBqR2e" Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-124afd03fd1so480797c88.0 for ; Thu, 05 Feb 2026 23:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361573; x=1770966373; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cvBmHx7kwJLfpYkQiDz3mWD0AMOGml1PQig1PAVjUmk=; b=LSkBqR2eL6UR5nwMRZBndcbURMFJdOjUd/7LtrdCVNaxoiZI9TTnSNToU8SmWi+nF8 m3dZITaCsmObraDFxNiM9H12rXoZMHWiddHcfIKALFHb7bSZ3ag6ui/cfQJIRZgSsTDo +s1YV90hyKpxBxYx5S+RHGiQVEFVIvkqd/4bo6r1gIt3/UqSHXLWg59ZZPoAt6iMN0BH Qb+0bJtH01Ffmaq53tPnznlrmOxmHSk9qndRyAPNNUxd8lJ5DkwmZj9Kzuphg0R2eswS MIbxkCxH3hRb2K6ipttH4gmcGSR2cEk+ICmGxsa2uGUfjAJz4c5gu9g7v38gRqbAY5JQ X5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361573; x=1770966373; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cvBmHx7kwJLfpYkQiDz3mWD0AMOGml1PQig1PAVjUmk=; b=wWdttKt7BUQOJptsMVnbo3d8W22BnrAgFkREmQPPzhROhFddOvxh68K0EhmH32RQ6c ySs3DXhfgQyNpLoU+llF1o5xLfxNGtbxWXhL+1MOEMQSLjJUy4MWoKplLvjTOVPbCsTt 6giqwqnJzTV5iufPSYQIlskhz8qM6agjgu3ZadJLswxhHVo+eK+yACVIHrRo+MvHM7so d+vG+lfM+Fi5Uvyr0nCylWuu7Tkc03BgLuFwzkx7OrG/4wdy3ipWcKcpLCoWokgMY4Vq Ze+Me/0uTfoYIQq79+c3Lb0ik56WTaWNA5AZyz/RiiDKbCeUiYMG6WioQ7cNIjet7wPx B96A== X-Gm-Message-State: AOJu0YzZDIVotyauiis3KFpplxewoOhp/sZYNTidJ9VsTdA2BwyGvxYM 81G6vdRKvBnUN4jHI/KSReZuBPe5Ki1ngWysPgIKXT/r7SjWSknA00tl X-Gm-Gg: AZuq6aJokLcMVBnxJP2K6ggT33M7mj1sj38PmSq5/Z48nVymXXrlDc340F7n5ipqo1S rvu7FALgkvz39yiCoVXHfHBm/0Ae4ZZjFibdFm3KhUJDxqnQBeWtm+HeaecNcAgWGEjyF8OHeKw 3NukECXp6Hoxv3RsTshQ+5OnRJMSqGjZVHkZ7toTQN5l2v9+b2tCN+R0J+egx8yT7lMp3UM/lZg ElxXa4dIB21IitoKEYluXOpZ06KuPidkiBTEeHVaN+IITHFnc6PAiCrIB18hv5KtIRMoT4/X04Y 6AOiJQzseM8FfyIa8UvTOzEtmILdsKVHEzyd6vNrIS8nW6ldjf4X92KZiTyKHRSZf4BqIXahHj8 0ZVOfaU2dikp+6o1MfZj83C+S/eB67x6lHnSXhcni7RgOw67UYO9nSJRmMEwPhBBp6G0mEz/mYm wntdP9qCpt6w== X-Received: by 2002:a05:7022:b81:b0:11a:e610:ee32 with SMTP id a92af1059eb24-12703ff4ba5mr818049c88.25.1770361573224; Thu, 05 Feb 2026 23:06:13 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:12 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:28 -0500 Subject: [PATCH RFC 07/12] workqueue: Dynamic housekeeping mask update support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-7-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Workqueues use housekeeping masks (HK_TYPE_WQ and HK_TYPE_DOMAIN) to determine the default affinity for unbound workqueues. Currently, these masks are only applied during early boot. Register a housekeeping notifier to dynamically update the workqueue unbound cpumask when these housekeeping masks are changed at runtime. This ensures that unbound workqueues are re-affined to the new housekeeping CPUs. Also update wq_isolated_cpumask to reflect the changes in HK_TYPE_DOMAIN. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/workqueue.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 253311af47c6..b8913935d5e8 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -7913,6 +7913,44 @@ static void __init wq_cpu_intensive_thresh_init(void) * executing the work items yet. Populate the worker pools with the initial * workers and enable future kworker creations. */ +static int wq_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + if (action =3D=3D HK_UPDATE_MASK) { + unsigned int type =3D (unsigned long)data; + + if (type =3D=3D HK_TYPE_WQ || type =3D=3D HK_TYPE_DOMAIN) { + cpumask_var_t cpumask; + + if (!alloc_cpumask_var(&cpumask, GFP_KERNEL)) + return NOTIFY_BAD; + + cpumask_copy(cpumask, cpu_possible_mask); + if (!cpumask_empty(housekeeping_cpumask(HK_TYPE_WQ))) + cpumask_and(cpumask, cpumask, housekeeping_cpumask(HK_TYPE_WQ)); + if (!cpumask_empty(housekeeping_cpumask(HK_TYPE_DOMAIN))) + cpumask_and(cpumask, cpumask, housekeeping_cpumask(HK_TYPE_DOMAIN)); + + workqueue_set_unbound_cpumask(cpumask); + + if (type =3D=3D HK_TYPE_DOMAIN) { + apply_wqattrs_lock(); + cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask, + housekeeping_cpumask(HK_TYPE_DOMAIN)); + apply_wqattrs_unlock(); + } + + free_cpumask_var(cpumask); + } + } + + return NOTIFY_OK; +} + +static struct notifier_block wq_housekeeping_nb =3D { + .notifier_call =3D wq_housekeeping_reconfigure, +}; + void __init workqueue_init(void) { struct workqueue_struct *wq; @@ -7964,6 +8002,7 @@ void __init workqueue_init(void) =20 wq_online =3D true; wq_watchdog_init(); + housekeeping_register_notifier(&wq_housekeeping_nb); } =20 /* --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f45.google.com (mail-dl1-f45.google.com [74.125.82.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D11330BB8D for ; Fri, 6 Feb 2026 07:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361582; cv=none; b=fwbBgQ/hDFxy8RPETXSUOwEE5bTMeZ/e3WJurpr+U9/cJmdSJ0ATH9MIfKNjS4MhIIQCnyphrU+uqnSy6zWQHcR4JruU1rA4HaDIBqgll3hSKCoyvqt3bl2K2++G8YMCiYvhlzjaxPdVA1APsAsHh3pt5RN0/Y6Mfy/iJmOTOc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361582; c=relaxed/simple; bh=UT29CcuMRb3rg0RO1+fhXxr1/+A+Ym9oJ4TW4s1z3Ts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U7mLq+R+A9vd0aLfRX+EdND/Ra9o0lnFJ4Yx7Ww6PVcu9BanvXzG37+ILZQOJcCGCU9uA3PC8+tEazgtNxF6Zym8l3GtfwcOSAxGY3gEaqd4M7ZEh87RQsmZ6nrq7QnTyLjK5GRPfz7b8DTix5M2uvxRZ6y4prMjZsdMvZxHiUs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EFaF5yZv; arc=none smtp.client-ip=74.125.82.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EFaF5yZv" Received: by mail-dl1-f45.google.com with SMTP id a92af1059eb24-1248d27f2b9so2080387c88.0 for ; Thu, 05 Feb 2026 23:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361581; x=1770966381; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BERFuyeKcGtNuzKkAmOfXnG5ws1V9eOTpauK4BW51xs=; b=EFaF5yZv68QQNl1tm6Mm9e3E9keRNcIePjuNsoZdRFtAbWh8rKz48nPgcbaOO44HUq yY+cvPntDO3UYps5J8+Q5EysHSzGAVVcDNutGmHxOdaObjJJLoCKojuzfQHDZjHmD46R fXIvkkJlWk89ORllqVsnFUnzM2+Q8WNqa5UJIiTDwpuST1/MGOsZMSSW+82ppsjOg4EO hSw5sjTAQyEKKDagyaIhKQciVBMQ1coKf8XsJre/kUFCkaARAYQEY9R849KHK7rPjVmO Z5r40DSAVbMwWkOEWmfNAc7Z83po8uWpV4ZWRSQUhe3YFqSNmF5S2+VJW93V3ipcVRUG X7tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361581; x=1770966381; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=BERFuyeKcGtNuzKkAmOfXnG5ws1V9eOTpauK4BW51xs=; b=d1FhEestfuktWpJF8MT90zVFVXXGKFZ17Z6yzZeSC2OicgnlRAVTYuAQEwmUj0+WkY x391gWmGJlGkc/W9uRn/uNGs/PxtaByLuzVrzR6sFCyFOhiN0wDTuuI62nCE4hB3bX+O LVHqYe+h2OVqSE3xlbYfVZC8OeoFBeGnWq5WCtPwe/AlPATS4aQsT/OBRue1nouKoBUQ 9Wuss13AGV7blEhbUXV3N6hggKHI79VWSESMi0I9XWNH83NN6KPWAcLmD59WSUMwwO4P bpJpas9pSTT1jyLA0MuQmoT8+B/GF3itvEYD4oBV2IMp1CZpvypxIsowK4jjjz1G6FN/ Rnxw== X-Gm-Message-State: AOJu0YzEbdlLAgDL72XTbZE08r9u6g7GGf+0n8j9fvV1UwYCyHnJ95pJ JMgb4MrFaocFDyr0d9voD8cJ5b8eVqOOUwFCrB7rvktRavc1KZB91y1g X-Gm-Gg: AZuq6aJIDi+lrsWQcj0fqJcwsc7pVCFiv2/V03389jNwQxS5QytpnRlXbCjyVCicLrj Kr0+AtczWW+NJhy5Xk+ZvPvMETOJDZOypuLYQsBfvCmAhzLtdYMDHIXTW+hTloPFzldnDuEEvkE z3fLdTDTsP5XOK4PVVw4X7OWaMHsvq8P45+C91LERWWReAY3sK7SYxT+qJZifXJioaPEr1UN9J6 40ivQYDjBuwO9jckEpqUHbGy/opXI08HRhei6JFbwGybI2UiHyAbrNMjIwuOpwdM8cdZVvIa5ek P1+hE9GtwzwMgs2Js/cYce7h2lKs5/FU5A3IcmrdOcmqoFAURiQzAyGmLfDYx7PB4qMUNRAXBjs GSFWOWVYrK2d0e+mC1Ww5HkL+x4Tln9xFtHKqQ+8612R/Y8SDi9Zgym+0Vwq82CuLITWTNFmIej trk+0cJYR64rZNiJmV5EGz X-Received: by 2002:a05:7022:226:b0:11a:6424:f40f with SMTP id a92af1059eb24-1270401630bmr793866c88.36.1770361581202; Thu, 05 Feb 2026 23:06:21 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:20 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:29 -0500 Subject: [PATCH RFC 08/12] kcompactd: Add housekeeping notifier for dynamic mask update Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-8-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 The kcompactd threads should respect the housekeeping mask for kthreads (HK_TYPE_KTHREAD) to avoid running on isolated CPUs. Currently, they are created without explicit affinity constraints beyond the node preference. Add housekeeping_affine() to kcompactd_run() to set initial affinity, and register a housekeeping notifier to update kcompactd affinity when the HK_TYPE_KTHREAD mask is changed at runtime. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- mm/compaction.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 1e8f8eca318c..495106d970f1 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "internal.h" =20 #ifdef CONFIG_COMPACTION @@ -3246,6 +3247,7 @@ void __meminit kcompactd_run(int nid) pr_err("Failed to start kcompactd on node %d\n", nid); pgdat->kcompactd =3D NULL; } else { + housekeeping_affine(pgdat->kcompactd, HK_TYPE_KTHREAD); wake_up_process(pgdat->kcompactd); } } @@ -3320,6 +3322,29 @@ static const struct ctl_table vm_compaction[] =3D { }, }; =20 +static int kcompactd_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + unsigned int type =3D (unsigned long)data; + + if (action =3D=3D HK_UPDATE_MASK && type =3D=3D HK_TYPE_KTHREAD) { + int nid; + + for_each_node_state(nid, N_MEMORY) { + pg_data_t *pgdat =3D NODE_DATA(nid); + + if (pgdat->kcompactd) + housekeeping_affine(pgdat->kcompactd, HK_TYPE_KTHREAD); + } + } + + return NOTIFY_OK; +} + +static struct notifier_block kcompactd_housekeeping_nb =3D { + .notifier_call =3D kcompactd_housekeeping_reconfigure, +}; + static int __init kcompactd_init(void) { int nid; @@ -3327,6 +3352,7 @@ static int __init kcompactd_init(void) for_each_node_state(nid, N_MEMORY) kcompactd_run(nid); register_sysctl_init("vm", vm_compaction); + housekeeping_register_notifier(&kcompactd_housekeeping_nb); return 0; } subsys_initcall(kcompactd_init) --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16B6E2D781B for ; Fri, 6 Feb 2026 07:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361592; cv=none; b=cRhGp5OLq0LzCusEiyS5IyZBpXd0QPa8xpPVf4h/GB7oAuRlqaq3sgUGb/HTrklihYmMEPCrv/xYieul8lNnElsGWtXZKzx9s2Co6C/2hY3GNsflXZIX2jTMV9T+Mtu9bIAvJt0r3vd8rwWkyz8o0kaStFEm5XoGtyPOCZuNng4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361592; c=relaxed/simple; bh=0oqbxcPwmQ5t2qh5YHGbOBPIaUL1kS8QlSZU9gar1mY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AGEryzSidre07A4u8dSqzSBgGrNZNqqi2RTXvxgeN9w5eB0MKy/LcADAti6IAswFRpPScmp5fOdBADYJCgP/YYqumQGE+jPxlGleNY9ABfVXJ6WUO/9xbCmO2Am5UzO1AWn7ezGaYqRDuD86Xp5mjEoZDJFoVRjFHKsSQuL6pJo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nhEdV8wA; arc=none smtp.client-ip=74.125.82.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nhEdV8wA" Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-2b81ebac5d6so2345089eec.1 for ; Thu, 05 Feb 2026 23:06:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361591; x=1770966391; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=l9mXbrAaMtQHRTGDa3ewvpAsXiHuJtYFWMHk8lDDECc=; b=nhEdV8wAm8LCyL/K2fRETkMujedzYBHStEG2ueMYUD6YKZ1jbz5ksXhPCQN8Z++mz8 Vb5kqK7MclKdo1/p+tKaQ+dKej5HBRCH10oPFglnkZy9DjG6QKe+off5joxKVhKqHPeM xjQXvcczHJmvWD011Zt5S0v8o1k1zMaxrYA0zPBwtW+1630j9UkuDpZSUTAB/2w5J6Ie 8V+P++I0FjfhU77L3RUj+bqWAV6YxB193dA32ivjz8oJ3m1/y1xyM5ldG37593T9ZaZS PN/qCPcn/htDXhi5Q8BE30YS2XNrU8xwaUJ9PKVduK0uy8LJ5xz112FPOpAMx5Z7ceLS 8wGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361591; x=1770966391; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=l9mXbrAaMtQHRTGDa3ewvpAsXiHuJtYFWMHk8lDDECc=; b=AtHAy/dciDzUvlzGwKVs5qt+i0vkxP77urIKV6uNjI7TbuEg7+/idcIl9iC5PTAXlm ignV0JPS8lO7vg1jllNiIPMWkZMS3hKtIAqzFVlMv/v2xCPriCDIhM6dgvUlCq9CI5r7 3aR4CZEtsthgynRdFbQEavRwxMnFc9bjfb+vY+mL06aXzhGaZbeJBwPGgOVq/4YWIsqx B8yXDYJVIyuNyLiPqh/FmsJbnJ8jAkpmHmOtD9fjnKcmZRL/ZEMJrlooYiA8BgmMp95t WNID3TtvSyVNancqnOlPGNFFXVzhE/qjTXv0x+oXZonHoaa/+rlpcEt/9K3Rn2aw16yf iAjA== X-Gm-Message-State: AOJu0Yxtfdfw6pj6hkeqIRXZRjgdslkmwxqFO2qz5Ixydj3p8DLKZM5X 1pPokMbNQAMUuSjrI4NSjU8pDWVcZpuNA1PLLDHocoSPjT6U0ZxQLBUr X-Gm-Gg: AZuq6aLZ32J7iM7I2h7PFbH4zBUZax+nK6VRiWIN3AmAKYs0gMdS49OaEBfT5a5Z4Jk NRcXHrovgy5L6IdGUsrYH+LJ68Z5oiJz1fIuH+F2e1ItGKGShgH6gifZgsslGwAb6dnp9qBVWm9 hagSEoeRxG9P85RiMsjJtak189kP5KyR//OeOk/ZumfmGqFVQmRCBwYj41c9R+W5lPodxva7HJ4 HtjLBE3mEXhAqK131BxzsFSKD/ezHjF9Zh0cVvdrNQsvGX2kKs56cR6SIcV5eqNvmpXzHujvjFh BU7vVv/oMLRVGO7OJOpC/wuecrICL247pM7C8xVGKlol0R2nlBQOegK7/mTVKlzr1q8hRCJEnQw umRz6zrVrcPrbuk9EeW2NPyp0Vb1p6/+j310uYdNGshmRssDE2RoWPAMKpWp+8/x1UImRBmuYpp iuW8XIPJMzhA1FlBdNYgWAjg== X-Received: by 2002:a05:7022:6612:b0:11b:9386:826c with SMTP id a92af1059eb24-1270405f72cmr986038c88.41.1770361591067; Thu, 05 Feb 2026 23:06:31 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:30 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:30 -0500 Subject: [PATCH RFC 09/12] sched/isolation: Separate housekeeping types and add sysfs interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-9-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Currently, most housekeeping types (timer, rcu, misc, etc.) share the same mask (HK_TYPE_KERNEL_NOISE), preventing fine-grained control over CPU isolation. Additionally, there is no way to update these masks at runtime. Separate the housekeeping types into individual enum entries and expand the cpumasks array to accommodate them. Introduce a sysfs interface at /sys/kernel/housekeeping/ that allows users to view and update the housekeeping masks for each type at runtime. When a mask is updated via sysfs, a notifier is triggered to re-affine the relevant kernel subsystems and services. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- include/linux/sched/isolation.h | 20 +++--- kernel/sched/isolation.c | 134 ++++++++++++++++++++++++++++++++++++= +++- 2 files changed, 140 insertions(+), 14 deletions(-) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolatio= n.h index 5c07e3e9b8d1..e8fe1cfa5022 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -10,21 +10,17 @@ enum hk_type { HK_TYPE_DOMAIN, HK_TYPE_MANAGED_IRQ, - HK_TYPE_KERNEL_NOISE, + HK_TYPE_TICK, + HK_TYPE_TIMER, + HK_TYPE_RCU, + HK_TYPE_MISC, + HK_TYPE_WQ, + HK_TYPE_KTHREAD, HK_TYPE_MAX, - - /* - * The following housekeeping types are only set by the nohz_full - * boot commandline option. So they can share the same value. - */ - HK_TYPE_TICK =3D HK_TYPE_KERNEL_NOISE, - HK_TYPE_TIMER =3D HK_TYPE_KERNEL_NOISE, - HK_TYPE_RCU =3D HK_TYPE_KERNEL_NOISE, - HK_TYPE_MISC =3D HK_TYPE_KERNEL_NOISE, - HK_TYPE_WQ =3D HK_TYPE_KERNEL_NOISE, - HK_TYPE_KTHREAD =3D HK_TYPE_KERNEL_NOISE }; =20 +#define HK_TYPE_KERNEL_NOISE HK_TYPE_TICK + struct housekeeping_update { enum hk_type type; const struct cpumask *new_mask; diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 97cc41626a33..d9ce26cf31fe 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -9,14 +9,26 @@ */ #include #include +#include +#include +#include +#include #include "sched.h" =20 enum hk_flags { HK_FLAG_DOMAIN =3D BIT(HK_TYPE_DOMAIN), HK_FLAG_MANAGED_IRQ =3D BIT(HK_TYPE_MANAGED_IRQ), - HK_FLAG_KERNEL_NOISE =3D BIT(HK_TYPE_KERNEL_NOISE), + HK_FLAG_TICK =3D BIT(HK_TYPE_TICK), + HK_FLAG_TIMER =3D BIT(HK_TYPE_TIMER), + HK_FLAG_RCU =3D BIT(HK_TYPE_RCU), + HK_FLAG_MISC =3D BIT(HK_TYPE_MISC), + HK_FLAG_WQ =3D BIT(HK_TYPE_WQ), + HK_FLAG_KTHREAD =3D BIT(HK_TYPE_KTHREAD), }; =20 +#define HK_FLAG_KERNEL_NOISE (HK_FLAG_TICK | HK_FLAG_TIMER | HK_FLAG_RCU |= \ + HK_FLAG_MISC | HK_FLAG_WQ | HK_FLAG_KTHREAD) + static DEFINE_MUTEX(housekeeping_mutex); static BLOCKING_NOTIFIER_HEAD(housekeeping_notifier_list); DEFINE_STATIC_KEY_FALSE(housekeeping_overridden); @@ -99,7 +111,7 @@ int housekeeping_unregister_notifier(struct notifier_blo= ck *nb) } EXPORT_SYMBOL_GPL(housekeeping_unregister_notifier); =20 -static int __maybe_unused housekeeping_update_notify(enum hk_type type, co= nst struct cpumask *new_mask) +static int housekeeping_update_notify(enum hk_type type, const struct cpum= ask *new_mask) { struct housekeeping_update update =3D { .type =3D type, @@ -109,6 +121,124 @@ static int __maybe_unused housekeeping_update_notify(= enum hk_type type, const st return blocking_notifier_call_chain(&housekeeping_notifier_list, HK_UPDAT= E_MASK, &update); } =20 +static const char * const hk_type_names[] =3D { + [HK_TYPE_TIMER] =3D "timer", + [HK_TYPE_RCU] =3D "rcu", + [HK_TYPE_MISC] =3D "misc", + [HK_TYPE_TICK] =3D "tick", + [HK_TYPE_DOMAIN] =3D "domain", + [HK_TYPE_WQ] =3D "workqueue", + [HK_TYPE_MANAGED_IRQ] =3D "managed_irq", + [HK_TYPE_KTHREAD] =3D "kthread", +}; + +struct hk_attribute { + struct kobj_attribute kattr; + enum hk_type type; +}; + +#define to_hk_attr(_kattr) container_of(_kattr, struct hk_attribute, kattr) + +static ssize_t housekeeping_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct hk_attribute *hk_attr =3D to_hk_attr(attr); + const struct cpumask *mask =3D housekeeping_cpumask(hk_attr->type); + + return cpumap_print_to_pagebuf(false, buf, mask); +} + +static ssize_t housekeeping_store(struct kobject *kobject, + struct kobj_attribute *attr, + const char *buf, size_t count) +{ + struct hk_attribute *hk_attr =3D to_hk_attr(attr); + enum hk_type type =3D hk_attr->type; + cpumask_var_t new_mask; + int err; + + if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) + return -ENOMEM; + + err =3D cpulist_parse(buf, new_mask); + if (err) + goto out_free; + + if (cpumask_empty(new_mask)) { + err =3D -EINVAL; + goto out_free; + } + + mutex_lock(&housekeeping_mutex); +=09 + if (!housekeeping.cpumasks[type]) { + if (!alloc_cpumask_var(&housekeeping.cpumasks[type], GFP_KERNEL)) { + err =3D -ENOMEM; + goto out_unlock; + } + } + + if (cpumask_equal(housekeeping.cpumasks[type], new_mask)) { + err =3D 0; + goto out_unlock; + } + + cpumask_copy(housekeeping.cpumasks[type], new_mask); + housekeeping.flags |=3D BIT(type); + static_branch_enable(&housekeeping_overridden); +=09 + housekeeping_update_notify(type, new_mask); +=09 + err =3D count; + +out_unlock: + mutex_unlock(&housekeeping_mutex); +out_free: + free_cpumask_var(new_mask); + return err < 0 ? err : count; +} + +static struct hk_attribute housekeeping_attrs[HK_TYPE_MAX]; +static struct attribute *housekeeping_attr_ptr[HK_TYPE_MAX + 1]; + +static const struct attribute_group housekeeping_attr_group =3D { + .attrs =3D housekeeping_attr_ptr, +}; + +static int __init housekeeping_sysfs_init(void) +{ + struct kobject *housekeeping_kobj; + int i, j =3D 0; + int ret; + + housekeeping_kobj =3D kobject_create_and_add("housekeeping", kernel_kobj); + if (!housekeeping_kobj) + return -ENOMEM; + + for (i =3D 0; i < HK_TYPE_MAX; i++) { + if (!hk_type_names[i]) + continue; + + housekeeping_attrs[i].type =3D i; + sysfs_attr_init(&housekeeping_attrs[i].kattr.attr); + housekeeping_attrs[i].kattr.attr.name =3D hk_type_names[i]; + housekeeping_attrs[i].kattr.attr.mode =3D 0644; + housekeeping_attrs[i].kattr.show =3D housekeeping_show; + housekeeping_attrs[i].kattr.store =3D housekeeping_store; + housekeeping_attr_ptr[j++] =3D &housekeeping_attrs[i].kattr.attr; + } + housekeeping_attr_ptr[j] =3D NULL; + + ret =3D sysfs_create_group(housekeeping_kobj, &housekeeping_attr_group); + if (ret) { + kobject_put(housekeeping_kobj); + return ret; + } + + return 0; +} +late_initcall(housekeeping_sysfs_init); + void housekeeping_init(void) { enum hk_type type; --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f41.google.com (mail-dl1-f41.google.com [74.125.82.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04E73302756 for ; Fri, 6 Feb 2026 07:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361600; cv=none; b=sOf+KPsNx8sQmCf/W9H3sFedUYLh8pcYFQs8QG3yAGCP57Dcj3NxDvfWZ9PLVbKrASbKGEyamp6a8Zlh9tKz78Epe6qulDOOp2sRzJRhIBHBMTsnAFQp0qWeo6flaALWqpBN2McllthGuTtWX1/fmV79A+1ePSqEs0rKlxcCbY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361600; c=relaxed/simple; bh=cRGXAJ9NhW/NzVEKCmA+1l7ZHGfhEHYfUt6gp9Z4JXs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N+xAOsI6vcuHf37O3gLFo8divnVc+IYzqQB/7IenRXrR6S6NIQMrHYTD/0KcPo2dyMDXlurPd55viAW6qqHk50ZFASVpHrSs2ihUGouVXxeEEQMhR5qBea6J5XXAVF54IZu4rInVjcSwGOTh8D6jRrbXcqEFoLntq9iaJqcgpE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cXtl1wCf; arc=none smtp.client-ip=74.125.82.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cXtl1wCf" Received: by mail-dl1-f41.google.com with SMTP id a92af1059eb24-124b117776fso1070892c88.0 for ; Thu, 05 Feb 2026 23:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361599; x=1770966399; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=WdBkyzLJQCBMuraYhS3VTvGUYkyPg06X/JmuXKPVjWg=; b=cXtl1wCfz1Sqom3s4sJ/ZuMQxCuwJfil53ss55CqrkLwNGjTFkN3mp8y727ReWjWhy RJwv+S/8iGcxWQiHDudqSyyPUHsTiCx/y1kzQ/Em6n2cRhlkZxs2h7D1Kt3Yz52TCIT3 Eu5sboJ4NvF8wmOI5tZMMfQqyIUucVpSnf5+fBCppNRTLbfdE/Eijskya9c3cSdDYmyR /moXSaBlwLl+IDlMfs4H3dj2YKckjE2h0tEyWZvmDg9N6FC4XTgah7IuX/9wkI+v1zgD iTXDZklf153XVWlDNz0U99iNN+NBjOpRZvqFLrDs6ZdOkQyEl4Fn4uKkL2+D7RYsOE+n LNCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361599; x=1770966399; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=WdBkyzLJQCBMuraYhS3VTvGUYkyPg06X/JmuXKPVjWg=; b=sjD2c9IV6i7PXHx1fU6WyjMdLQUwvQ//RFcuxy/t2vpGKgfRUq7PJpb4A7CC4kn+1s 9vKhPQncHJPvFYHP8iymIRi6GR+RGV37sWpMU0DRYqdILFsCZEiCn3mXDF/susJhDMWH z/hcps9maLyJeU6GbsuJ7S7A9uyrczJFnbbtPPr2GRzwGp/vffON86c5att1Oo82hRdG S6YmrHfxYc1XShcXEIa5aPfJqmaTWLFRYH1B7QENv5QyKSo37BUhZ0rCs+zhS58ZKLX4 /nY4XnR7rw1L7PUxHsP2ea2RD4Q5vWUFTDTm9C6OcuMV5SD668kv9HHbBRhkSTDLcFAW Fc0A== X-Gm-Message-State: AOJu0YzGQdsYaZe2zDrFID1LiNtWdtrHPn6k0eKgWchmcsS9mcVAlbso 6rE54uDyWjhvgcjm2ZdA1+e9lZiui0RSMeS5tFxOj9/ZVr0YZsG3zKM7 X-Gm-Gg: AZuq6aLKfO4ecNOaSgc0NZNQK4DnYqg2KQCcb9FPrE/vNSp64a/cwD+QLxLRYDYdVLZ Wc+G74hD4RiLcUWyhw62bqGO1WhkUBnDtTEYP483W46kZs3dEZFDjIcqKo9pE90jCAY/76QO2GP fQf0u1y2R+708ajgV97WXf6g2f2x+aK4fG0g5RqRzGFIUz/I+AyKALsfGYCOjjC2GwMdJeSeaDL gF+DmYpA9qRFlX34Wnw9S7zQNj33PtCSjjTpbXS/HRzWS4CI318c44fuoJxqfdoOmbbd0Zdkz8O k/tZsBLWAgs5KqW2o7UgDiCeDGVuABLW54kerDdZ57TcZDGW9XdpPcpWeMLa56fHLhESbmPeZAY +j5MdJwgblxVG6VR9IxCZLnnUv9vTaZXQGKTS8bslGzDyyH/vntCequqdzORo8iljJo0NvCS+Ae vrDuDSsRT9uQ== X-Received: by 2002:a05:7022:4597:b0:119:e56b:98a4 with SMTP id a92af1059eb24-12703fe5655mr919986c88.11.1770361599017; Thu, 05 Feb 2026 23:06:39 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:38 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:31 -0500 Subject: [PATCH RFC 10/12] tick/nohz: Implement dynamic nohz_full state update Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-10-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 The nohz_full state (tick_nohz_full_mask) is currently a boot-time configuration that cannot be changed at runtime. This prevents dynamic CPU isolation from being fully effective, as the scheduler tick continues to run on newly isolated CPUs. Remove the __init restriction from tick_nohz_full_setup() and tick_nohz_init(). Implement a housekeeping notifier in the tick-sched subsystem to handle HK_TYPE_TICK updates. When the mask is updated, the new isolation mask is calculated and applied, and all online CPUs are kicked to re-evaluate their tick dependency. This allows the kernel to dynamically enter or exit full dynticks mode on any CPU at runtime. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- include/linux/tick.h | 2 +- kernel/time/tick-sched.c | 63 ++++++++++++++++++++++++++++++++++++++++++++= +--- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index ac76ae9fa36d..40047523ec8c 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -271,7 +271,7 @@ static inline void tick_dep_clear_signal(struct signal_= struct *signal, =20 extern void tick_nohz_full_kick_cpu(int cpu); extern void __tick_nohz_task_switch(void); -extern void __init tick_nohz_full_setup(cpumask_var_t cpumask); +extern void tick_nohz_full_setup(cpumask_var_t cpumask); #else static inline bool tick_nohz_full_enabled(void) { return false; } static inline bool tick_nohz_full_cpu(int cpu) { return false; } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 2f8a7923fa27..01d62dfc153f 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -27,6 +27,7 @@ #include #include #include +#include =20 #include =20 @@ -619,9 +620,14 @@ void __tick_nohz_task_switch(void) } =20 /* Get the boot-time nohz CPU list from the kernel parameters. */ -void __init tick_nohz_full_setup(cpumask_var_t cpumask) +void tick_nohz_full_setup(cpumask_var_t cpumask) { - alloc_bootmem_cpumask_var(&tick_nohz_full_mask); + if (!tick_nohz_full_mask) { + if (system_state < SYSTEM_RUNNING) + alloc_bootmem_cpumask_var(&tick_nohz_full_mask); + else + zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL); + } cpumask_copy(tick_nohz_full_mask, cpumask); tick_nohz_full_running =3D true; } @@ -643,10 +649,61 @@ static int tick_nohz_cpu_down(unsigned int cpu) return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY; } =20 -void __init tick_nohz_init(void) +static int tick_nohz_housekeeping_reconfigure(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct housekeeping_update *upd =3D data; + int cpu; + + if (action =3D=3D HK_UPDATE_MASK && upd->type =3D=3D HK_TYPE_TICK) { + cpumask_var_t non_housekeeping_mask; + + if (!alloc_cpumask_var(&non_housekeeping_mask, GFP_KERNEL)) + return NOTIFY_BAD; + + cpumask_andnot(non_housekeeping_mask, cpu_possible_mask, upd->new_mask); + + if (!tick_nohz_full_mask) { + if (!zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL)) { + free_cpumask_var(non_housekeeping_mask); + return NOTIFY_BAD; + } + } + + /* Kick all CPUs to re-evaluate tick dependency before change */ + for_each_online_cpu(cpu) + tick_nohz_full_kick_cpu(cpu); + + cpumask_copy(tick_nohz_full_mask, non_housekeeping_mask); + tick_nohz_full_running =3D !cpumask_empty(tick_nohz_full_mask); + + /* Kick all CPUs again to apply new nohz full state */ + for_each_online_cpu(cpu) + tick_nohz_full_kick_cpu(cpu); + + free_cpumask_var(non_housekeeping_mask); + } + + return NOTIFY_OK; +} + +static struct notifier_block tick_nohz_housekeeping_nb =3D { + .notifier_call =3D tick_nohz_housekeeping_reconfigure, +}; + +void tick_nohz_init(void) { int cpu, ret; =20 + if (!tick_nohz_full_mask) { + if (system_state < SYSTEM_RUNNING) + alloc_bootmem_cpumask_var(&tick_nohz_full_mask); + else + zalloc_cpumask_var(&tick_nohz_full_mask, GFP_KERNEL); + } + + housekeeping_register_notifier(&tick_nohz_housekeeping_nb); + if (!tick_nohz_full_running) return; =20 --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f43.google.com (mail-dl1-f43.google.com [74.125.82.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A0332D781B for ; Fri, 6 Feb 2026 07:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361609; cv=none; b=qBfjtYOwIB/HNsNjY2NpN594h1tffODeAAPXHJQi9qeolwJiP4ubfsMlXy7Q+HmYyfKLhUK1KZiABgG9sS0as8NQ2ezEDsl9k1+ZXcmu30e6EJ1wwssCfqCs1Fr76gZNKInJvVorDsZ0TLUSih6SNwcUiWIbJskoXTOnxE+7uaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361609; c=relaxed/simple; bh=28SwfWNF2pPonaYGLUdwZIYTQscIfrvAugzJGAuI9IM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cCQDc6kdyBGCkhCRaE+ztDWGP09D5UGTEQvl0o6Xys09gHFZrslVa3tNX+vI+v5uKtdfSj+mTHe5xXMJUcceTqyNh7QIytCDPhbGNz9Ark+eVxDD8Y/0kCZjy1Fu+0j+P+GWuNL9rs/HDja8q5cwDD4uoZPvS2j5kbGGjG6Xdus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kbmSbw2h; arc=none smtp.client-ip=74.125.82.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kbmSbw2h" Received: by mail-dl1-f43.google.com with SMTP id a92af1059eb24-1233b953bebso4470817c88.1 for ; Thu, 05 Feb 2026 23:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361608; x=1770966408; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=e1sUxC0YZUR64lsfhayk4QokW4yT43rWvxMvoedrPqg=; b=kbmSbw2hYbNlmGl2Mxuslh85IqgJWXCS/FJhL2vamxdul5q3tQScKtxSjSqDPtZVAy rNDmNNm+FMC0E2KfBBZ5Ak8A7/2PqR5xX/kJiV/2kFcXEsRCi+c49/g/4l5pqR3uOeln kCCQxrCGeipPN+ZvJOS3clLOELJcY925JbsWj18EyzkhK8NQLNAc50/vK7HseeEIy7A5 sduMilg3NzYso180ISqK+UNwSW+e28dJGkbZhvclSIQ4E/IOQ2KQTbv4Q+qYMQAwV2vp DH5x6AC57lBrX7RYeEU2OqY15T2qfs6PE1/0ET8iYWjWBlVuVnz4AGQMNL778fZ0nI4r nxPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361608; x=1770966408; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=e1sUxC0YZUR64lsfhayk4QokW4yT43rWvxMvoedrPqg=; b=c6fp37DlR3ugxtqmr/56oVa3XTzhikp9tt3t0MiA5OS/BsoresyP+3Cz5YGiY1e0i1 2DVpjC6TNgEKt2bFHX8dJmnABvT+4BOehz6EXrzhUsT7i9h+ASAbzfhqC8M1jAFhnr0v ws8DgN4kr7lQFCAzslljwZzy8RA/Co90T9vD3ieV4M6csV/Xvb2VPbq5+0yC8pH9vfiI FnAGIs9ctRkrEZUkBp6oBR/nsHJZ1tRaoK9j0RsLmFd5cPLto/8GrXiNrMa6SDaRMO9w 0wl6WW3rM6w96Ai5r8XzF/ocgD2sFCchAcnNdUwEEBanb3mD89Nnr9JxzKtPNMzzm83G USig== X-Gm-Message-State: AOJu0YwVGstIE6AfYBfenC++vNi1oHiRS7wEleMmXnNOqlmw6TshE3Y0 10QyJzYkOtdIH5AraqY9TZh3jhJ+SloN9+ygPByhxSEDwNjdZyjSJ38B X-Gm-Gg: AZuq6aL5HYExR2eTFlTGhUz8uN+r5gEEiKQyL6Po6aFzBcY8/uE2amaOyyrIaqCJ5ix hcgkavM0a6LnAW42Pqg891cdtOlA5CLGpeTsGmPso2udFOFSNZWrifZfqy71guDFx56Ud/b7LIy 2Acq1jp3L/uJl9Mnev1oo87SU5kGGw+G77cz4lkKK7xCMgxc6Y8pI3OBH/yrR/GCIBUn+9gw1Ov JdAF1k7dczGO+XTBIanYswN3nl4dExBdHhvjKQtouOWy99EqhV4ctGc6MlM6d+AclUXPNH0JSyq YiiQvnb6XvBzVhrCBIP+VxCxhYnRSUi+osy5eefDfumt+SfZNjXXDwXcxd+RAQ+srb0k6EtzaK2 K9GNd2RooAkMw8Y/KuQm/grjSNKogCNN1UeNiPLxZdXRblT1LPMAm0Pm9AYA77Q0Ldi8LbpXkYt 9eYydxWt7+fw== X-Received: by 2002:a05:7300:4352:b0:2ae:59dd:cfd1 with SMTP id 5a478bee46e88-2b856722ff3mr747970eec.22.1770361608102; Thu, 05 Feb 2026 23:06:48 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:47 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:32 -0500 Subject: [PATCH RFC 11/12] sched/isolation: Implement SMT sibling auto-isolation and safety check Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-11-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Implement SMT sibling auto-isolation logic via 'smt_aware_mode' sysfs node. When enabled, writing to housekeeping masks will automatically ensure that all siblings of a physical core stay together in the same isolation state. Also implement a safety check in housekeeping_store() to ensure that at least one online CPU remains as housekeeping, preventing the user from accidentally isolating all CPUs and locking up the system. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/sched/isolation.c | 72 ++++++++++++++++++++++++++++++++++++++++++++= ---- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index d9ce26cf31fe..30798e790b9f 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "sched.h" =20 enum hk_flags { @@ -40,6 +41,30 @@ struct housekeeping { }; =20 static struct housekeeping housekeeping; +static bool housekeeping_smt_aware; + +static ssize_t smt_aware_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", housekeeping_smt_aware); +} + +static ssize_t smt_aware_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t count) +{ + bool val; + + if (kstrtobool(buf, &val)) + return -EINVAL; + + housekeeping_smt_aware =3D val; + + return count; +} + +static struct kobj_attribute smt_aware_attr =3D + __ATTR(smt_aware_mode, 0644, smt_aware_show, smt_aware_store); =20 bool housekeeping_enabled(enum hk_type type) { @@ -164,11 +189,40 @@ static ssize_t housekeeping_store(struct kobject *kob= ject, if (err) goto out_free; =20 - if (cpumask_empty(new_mask)) { + /* Safety check: must have at least one online CPU for housekeeping */ + if (!cpumask_intersects(new_mask, cpu_online_mask)) { err =3D -EINVAL; goto out_free; } =20 + if (housekeeping_smt_aware) { + int cpu, sibling; + cpumask_var_t tmp_mask; + + if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL)) { + err =3D -ENOMEM; + goto out_free; + } + + cpumask_copy(tmp_mask, new_mask); + for_each_cpu(cpu, tmp_mask) { + for_each_cpu(sibling, topology_sibling_cpumask(cpu)) { + if (!cpumask_test_cpu(sibling, tmp_mask)) { + /* SMT sibling should stay grouped */ + cpumask_clear_cpu(cpu, new_mask); + break; + } + } + } + free_cpumask_var(tmp_mask); + + /* Re-check after SMT sync */ + if (!cpumask_intersects(new_mask, cpu_online_mask)) { + err =3D -EINVAL; + goto out_free; + } + } + mutex_lock(&housekeeping_mutex); =09 if (!housekeeping.cpumasks[type]) { @@ -230,12 +284,20 @@ static int __init housekeeping_sysfs_init(void) housekeeping_attr_ptr[j] =3D NULL; =20 ret =3D sysfs_create_group(housekeeping_kobj, &housekeeping_attr_group); - if (ret) { - kobject_put(housekeeping_kobj); - return ret; - } + if (ret) + goto err_group; + + ret =3D sysfs_create_file(housekeeping_kobj, &smt_aware_attr.attr); + if (ret) + goto err_file; =20 return 0; + +err_file: + sysfs_remove_group(housekeeping_kobj, &housekeeping_attr_group); +err_group: + kobject_put(housekeeping_kobj); + return ret; } late_initcall(housekeeping_sysfs_init); =20 --=20 2.51.0 From nobody Sun Feb 8 13:40:02 2026 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59D3733B6CD for ; Fri, 6 Feb 2026 07:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361619; cv=none; b=VoUtu4U0is+7M0HXHutgKN3nGON9A/WrIaD/r3dxFu4cJLUHEWeekx1B+UhUGTuXQashW2MwYjk/HZlgRXtuA6/R1SLRtsVwUxFqS1Oby43Njs5zQr48nTSwqBXTWyTRO0XlUf4fZWyz8dGToBPzWiTz133yB79R3n8+G+gitLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770361619; c=relaxed/simple; bh=PRKDEd0DYfuHb9hL0NHmI1iyuE2ic2UZYJ1SCf8GC4A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SAu4P9thjjz8vIBdVZtQYn2jWmyPHxrzXhgfl68nr9JF9VftvPDA7wdX6Y/i6bxK1lN5BOrBAmMepF4LKW4KKN7lP2RGu0uUzQDGN9u6TpGGdpGNe7f8RVQc7lISs1naaLLhqNNPtsK4WzmoKThIErbqBEARfBhZX/8zgbXeANI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R17uleyv; arc=none smtp.client-ip=74.125.82.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R17uleyv" Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-11f36012fb2so354554c88.1 for ; Thu, 05 Feb 2026 23:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770361619; x=1770966419; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=po+cGkyQwauqMh1hjbbX16QLLaNcnoHPzcdRT786Xgc=; b=R17uleyvbgkHINzm2c3UIwuAAcqAX5NRsO4rHh8+WorBr0dC0ddc6PAyAtA0mOMT4v GHXmQXoU3gDFMFRIN1UJvJHQy4f6VnjXF+Q0bfyHW6atufx8QeQ5l8rwq3Pl2G9y1M6N 2BbKPXbSiwcZuxZ5oLhKj3nM0hzExL15uTdW4vYYAY3ncBgxOKV1IyRP7X2FSoLljfKg X5xgnVKSPle1M5qgJ1jLz+nDTvI2/6H1WKwHR5E9QQVs8pi772yp8AdXSLNpa6Opzyw9 uxU5u4FAvzf8fEwkFt3eMwQy3c8VTGvaAAW4kJmaJAeDIKC02NGHkLGbCkwJtNgrc9xf eRpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770361619; x=1770966419; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=po+cGkyQwauqMh1hjbbX16QLLaNcnoHPzcdRT786Xgc=; b=svkffqJlHai5iXp94qdCAYhiCilPzt06mDBvg/kBxaPWNfPybGgG34OH28Ttx12Bi9 PL5MI5weCa5+KC/QRyEc/4nvZB2NFxt8iotNmiPNB4gepAiehRUwVgQAevnHwF17VTt8 3NA/vj0Lrud+iLduX2aSftoo9I+yZ3pLdg5koNW7pkXM5c/yIhwjXjmBf5FVdcAdGXip Auc9rcWYrh9Qw97AUdeZdrlzt1Beo+hx64a/69TCwTyLIN/rexA34FUM0RnVes0phaVS NZo/x4CPgjzxY45yhFTi7qQFll8dPrIFtzX48AodOgPRQpzobCg9kv5shMifN3IMPRGe DbVA== X-Gm-Message-State: AOJu0YzSDGnYc7MJJ5xcGaBaHodLbZnDL0kBdua0aNYhFe/THoZXzgaL PL+ngWao9PzN/nlG9qtzUmm2zuV1nMegRxZNXp8EUxS8eix78EzA0G5G X-Gm-Gg: AZuq6aIXN5rBR7r17b3mA1ydi0bZlY18nUK/g1MW9CBQy9/Hu/9QWN1qe4rh6i4lFxb lrFNJ2VIlkRnWqEiadJSDycCqi9P56+S5aDweVa5XhSfYLLY9qD76lui07WftjG3pPOz4XWC56N XU8sIIjubDOczd8bsz+5tS2Hc7vkwFa/KcAOBsHiW0mFBEQ4Xi6C8uL1H+jCnJjNLIPv3q+WW89 AmZ0aDGNAIyLnfnEO1olPvWjLtGNwlbnYa8+2+XE+S66n5HKxFeObhQiXjXnfCP91+k/1i4v8SZ g8eFoZKt1YQb/pjrzEThsSu1RL89Z84RwZMVUw7h13/o7cMX+gp6AU0tCoJ+Esrxidd2+ogJaYs hZcmJEPgD2f3g/yDI/rq1LudYIP7dKL4xgmGMNTf0Iw2UqyuPHV2fkoTPV7suezce9DOpDhVIhX Y7ibiA1cLAng== X-Received: by 2002:a05:7022:660f:b0:11b:baa5:f4d1 with SMTP id a92af1059eb24-12703f54339mr757958c88.6.1770361618556; Thu, 05 Feb 2026 23:06:58 -0800 (PST) Received: from [127.0.1.1] ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-127041e61b9sm1592601c88.8.2026.02.05.23.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 23:06:58 -0800 (PST) From: Qiliang Yuan Date: Fri, 06 Feb 2026 02:04:33 -0500 Subject: [PATCH RFC 12/12] sched/isolation: Bridge isolcpus and support runtime tick offload init Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260206-feature-dynamic_isolcpus_dhei-v1-12-00a711eb0c74@gmail.com> References: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> In-Reply-To: <20260206-feature-dynamic_isolcpus_dhei-v1-0-00a711eb0c74@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Thomas Gleixner , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Anna-Maria Behnsen , Ingo Molnar Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, Qiliang Yuan , Qiliang Yuan X-Mailer: b4 0.14.3 Bridge the boot-time 'isolcpus' and 'nohz_full' parameters with the DHEI sysfs interface. Ensure that housekeeping_init() correctly initializes the isolation state and that subsequent sysfs updates can take over management even if no isolation was configured at boot. Remove __init from sched_tick_offload_init() and update it to be safe for multiple calls. This allows DHEI to initialize tick offload infrastructure at runtime when the first tick-isolated core is configured. Signed-off-by: Qiliang Yuan Signed-off-by: Qiliang Yuan --- kernel/sched/core.c | 5 ++++- kernel/sched/isolation.c | 3 +++ kernel/sched/sched.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 045f83ad261e..d155e1132d6b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5685,8 +5685,11 @@ static void sched_tick_stop(int cpu) } #endif /* CONFIG_HOTPLUG_CPU */ =20 -int __init sched_tick_offload_init(void) +int sched_tick_offload_init(void) { + if (tick_work_cpu) + return 0; + tick_work_cpu =3D alloc_percpu(struct tick_work); BUG_ON(!tick_work_cpu); return 0; diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 30798e790b9f..76c039a01fb0 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -241,6 +241,9 @@ static ssize_t housekeeping_store(struct kobject *kobje= ct, housekeeping.flags |=3D BIT(type); static_branch_enable(&housekeeping_overridden); =09 + if (type =3D=3D HK_TYPE_TICK || type =3D=3D HK_TYPE_TIMER || type =3D=3D = HK_TYPE_RCU) + sched_tick_offload_init(); + housekeeping_update_notify(type, new_mask); =09 err =3D count; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 93fce4bbff5e..0079e7210c38 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2867,7 +2867,7 @@ extern void post_init_entity_util_avg(struct task_str= uct *p); =20 #ifdef CONFIG_NO_HZ_FULL extern bool sched_can_stop_tick(struct rq *rq); -extern int __init sched_tick_offload_init(void); +extern int sched_tick_offload_init(void); =20 /* * Tick may be needed by tasks in the runqueue depending on their policy a= nd --=20 2.51.0