[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1427493027-15955-2-git-send-email-riel@redhat.com>
Date: Fri, 27 Mar 2015 17:50:26 -0400
From: riel@...hat.com
To: linux-kernel@...r.kernel.org
Cc: lizefan@...wei.com, tj@...nel.org, gregkh@...uxfoundation.org,
Rik van Riel <riel@...hat.com>
Subject: [PATCH 1/2] show isolated cpus in sysfs
From: Rik van Riel <riel@...hat.com>
After system bootup, there is no totally reliable way to see
which CPUs are isolated, because the kernel may modify the
CPUs specified on the isolcpus= kernel command line option.
Export the CPU list that actually got isolated in sysfs,
specifically in the file /sys/devices/system/cpu/isolated
Suggested-by: Li Zefan <lizefan@...wei.com>
Signed-off-by: Rik van Riel <riel@...hat.com>
---
drivers/base/cpu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index f160ea44a86d..ea23ee7b545b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -265,6 +265,17 @@ static ssize_t print_cpus_offline(struct device *dev,
}
static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
+static ssize_t print_cpus_isolated(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int n = 0, len = PAGE_SIZE-2;
+
+ n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(cpu_isolated_map));
+
+ return n;
+}
+static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
+
static void cpu_device_release(struct device *dev)
{
/*
@@ -431,6 +442,7 @@ static struct attribute *cpu_root_attrs[] = {
&cpu_attrs[2].attr.attr,
&dev_attr_kernel_max.attr,
&dev_attr_offline.attr,
+ &dev_attr_isolated.attr,
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
&dev_attr_modalias.attr,
#endif
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists