All of lore.kernel.org
 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 2/2] show nohz_full cpus in sysfs
Date: Fri, 27 Mar 2015 17:50:27 -0400	[thread overview]
Message-ID: <1427493027-15955-3-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>

Currently there is no way to query which CPUs are in nohz_full
mode from userspace.

Export the CPU list running in nohz_full mode in sysfs,
specifically in the file /sys/devices/system/cpu/nohz_full

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 drivers/base/cpu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index ea23ee7b545b..78720e706176 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -16,6 +16,7 @@
 #include <linux/acpi.h>
 #include <linux/of.h>
 #include <linux/cpufeature.h>
+#include <linux/tick.h>
 
 #include "base.h"
 
@@ -276,6 +277,19 @@ static ssize_t print_cpus_isolated(struct device *dev,
 }
 static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
 
+#ifdef CONFIG_NO_HZ_FULL
+static ssize_t print_cpus_nohz_full(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(tick_nohz_full_mask));
+
+	return n;
+}
+static DEVICE_ATTR(nohz_full, 0444, print_cpus_nohz_full, NULL);
+#endif
+
 static void cpu_device_release(struct device *dev)
 {
 	/*
@@ -443,6 +457,9 @@ static struct attribute *cpu_root_attrs[] = {
 	&dev_attr_kernel_max.attr,
 	&dev_attr_offline.attr,
 	&dev_attr_isolated.attr,
+#ifdef CONFIG_NO_HZ_FULL
+	&dev_attr_nohz_full.attr,
+#endif
 #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
 	&dev_attr_modalias.attr,
 #endif
-- 
2.1.0


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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 21:50 [PATCH 0/2] show isolated & nohz_full cpus in sysfs riel
2015-03-27 21:50 ` [PATCH 1/2] show isolated " riel
2015-03-27 21:50 ` riel [this message]
2015-03-28  4:18   ` [PATCH 2/2] show nohz_full " 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 2/2] show " riel
2015-04-28 19:18   ` Chris Metcalf

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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.