From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: tj@kernel.org, umgwanakikbuti@gmail.com, lizefan@huawei.com,
fweisbec@gmail.com, gregkh@linuxfoundation.org
Subject: [PATCH 2/2] show nohz_full cpus in sysfs
Date: Fri, 24 Apr 2015 15:24:28 -0400 [thread overview]
Message-ID: <1429903468-11099-3-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1429903468-11099-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
This can be used by system management tools like libvirt,
openstack, and others to ensure proper task placement.
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
next prev parent reply other threads:[~2015-04-24 19:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 19:24 [PATCH 0/2 resend] show isolated & nohz_full cpus in sysfs 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
2015-04-24 19:24 ` riel [this message]
2015-04-28 19:18 ` [PATCH 2/2] show nohz_full " Chris Metcalf
2015-04-25 5:29 ` [PATCH 0/2 resend] show isolated & " Mike Galbraith
-- strict thread matches above, loose matches on Subject: below --
2015-03-27 21:50 [PATCH 0/2] " riel
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
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=1429903468-11099-3-git-send-email-riel@redhat.com \
--to=riel@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=tj@kernel.org \
--cc=umgwanakikbuti@gmail.com \
/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.