[RFC v2 8/9] sysfs: Add cpu_avoid file
Shrikanth Hegde
sshegde at linux.ibm.com
Thu Jun 26 05:11:07 AEST 2025
Add a sysfs file called "avoid" which prints the current CPUs
makred as avoid.
This could be used by userspace components or tools such as irqbalance.
/sys/devices/system/cpu # cat avoid
70-479
Signed-off-by: Shrikanth Hegde <sshegde at linux.ibm.com>
---
drivers/base/cpu.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 7779ab0ca7ce..51c1207f6f33 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -300,6 +300,13 @@ static ssize_t print_cpus_isolated(struct device *dev,
}
static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
+static ssize_t print_cpus_avoid(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpu_avoid_mask));
+}
+static DEVICE_ATTR(avoid, 0444, print_cpus_avoid, NULL);
+
#ifdef CONFIG_NO_HZ_FULL
static ssize_t print_cpus_nohz_full(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -505,6 +512,7 @@ static struct attribute *cpu_root_attrs[] = {
&dev_attr_offline.attr,
&dev_attr_enabled.attr,
&dev_attr_isolated.attr,
+ &dev_attr_avoid.attr,
#ifdef CONFIG_NO_HZ_FULL
&dev_attr_nohz_full.attr,
#endif
--
2.43.0
More information about the Linuxppc-dev
mailing list