Skip to content

Commit cd22926

Browse files
aarontomlingregkh
authored andcommitted
tick/nohz: Expose housekeeping CPUs in sysfs
Expose the current system-defined list of housekeeping CPUs in a new sysfs file: /sys/devices/system/cpu/housekeeping. This provides userspace performance tuning tools and resource managers with a canonical, reliable method to accurately identify the cores responsible for essential kernel maintenance workloads (RCU, timer callbacks, and unbound workqueues). Currently, tooling must manually calculate the housekeeping set by parsing complex kernel boot parameters (like isolcpus= and nohz_full=) and system topology, which is prone to error. This dedicated file simplifies the configuration of low-latency workloads. Signed-off-by: Aaron Tomlin <atomlin@atomlin.com> Link: https://patch.msgid.link/20251011012853.7539-2-atomlin@atomlin.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f10c23f commit cd22926

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,17 @@ Description:
764764
participate in load balancing. These CPUs are set by
765765
boot parameter "isolcpus=".
766766

767+
What: /sys/devices/system/cpu/housekeeping
768+
Date: Oct 2025
769+
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
770+
Description:
771+
(RO) the list of logical CPUs that are designated by the kernel as
772+
"housekeeping". Each CPU are responsible for handling essential
773+
system-wide background tasks, including RCU callbacks, delayed
774+
timer callbacks, and unbound workqueues, minimizing scheduling
775+
jitter on low-latency, isolated CPUs. These CPUs are set when boot
776+
parameter "isolcpus=nohz" or "nohz_full=" is specified.
777+
767778
What: /sys/devices/system/cpu/crash_hotplug
768779
Date: Aug 2023
769780
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>

drivers/base/cpu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,19 @@ static ssize_t print_cpus_isolated(struct device *dev,
300300
}
301301
static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
302302

303+
static ssize_t housekeeping_show(struct device *dev,
304+
struct device_attribute *attr, char *buf)
305+
{
306+
const struct cpumask *hk_mask;
307+
308+
hk_mask = housekeeping_cpumask(HK_TYPE_KERNEL_NOISE);
309+
310+
if (housekeeping_enabled(HK_TYPE_KERNEL_NOISE))
311+
return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(hk_mask));
312+
return sysfs_emit(buf, "\n");
313+
}
314+
static DEVICE_ATTR_RO(housekeeping);
315+
303316
#ifdef CONFIG_NO_HZ_FULL
304317
static ssize_t nohz_full_show(struct device *dev,
305318
struct device_attribute *attr,
@@ -509,6 +522,7 @@ static struct attribute *cpu_root_attrs[] = {
509522
&dev_attr_offline.attr,
510523
&dev_attr_enabled.attr,
511524
&dev_attr_isolated.attr,
525+
&dev_attr_housekeeping.attr,
512526
#ifdef CONFIG_NO_HZ_FULL
513527
&dev_attr_nohz_full.attr,
514528
#endif

0 commit comments

Comments
 (0)