mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: lizefan@huawei.com, tj@kernel.org, gregkh@linuxfoundation.org,
	Rik van Riel <riel@redhat.com>
Subject: [PATCH 1/2] show isolated cpus in sysfs
Date: Fri, 27 Mar 2015 17:50:26 -0400	[thread overview]
Message-ID: <1427493027-15955-2-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1427493027-15955-1-git-send-email-riel@redhat.com>

From: Rik van Riel <riel@redhat.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@huawei.com>
Signed-off-by: Rik van Riel <riel@redhat.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


  reply	other threads:[~2015-03-27 21:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 21:50 [PATCH 0/2] show isolated & nohz_full " riel
2015-03-27 21:50 ` riel [this message]
2015-03-27 21:50 ` [PATCH 2/2] show " riel
2015-03-28  4:18   ` Mike Galbraith
2015-03-28 13:35     ` Rik van Riel
2015-03-28 14:10       ` Mike Galbraith
2015-03-28 16:02   ` Frederic Weisbecker
2015-03-28 16:15     ` Rik van Riel
2015-03-28 18:06       ` Frederic Weisbecker
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & " riel
2015-04-24 19:24 ` [PATCH 1/2] show isolated " riel
2015-04-24 21:11   ` Frederic Weisbecker
2015-04-24 21:16     ` Tejun Heo
2015-04-24 21:22     ` Rik van Riel
2015-04-24 21:49       ` Greg KH
2015-05-04 21:15         ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427493027-15955-2-git-send-email-riel@redhat.com \
    --to=riel@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome