Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 04/24/2015 03:24 PM, r...@redhat.com wrote: From: Rik van Riel 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 --- drivers/base/cpu.c | 17 + 1 file changed, 17 insertions(+) In the arch/tile distribution with our "dataplane" support, we have traditionally had a /sys/devices/system/cpu/dataplane file with the same semantics you are proposing. It's definitely helpful to userspace applications figuring out how to appropriately take over the machine they are being run on. Acked-by: Chris Metcalf -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 04/24/2015 03:24 PM, r...@redhat.com wrote: From: Rik van Rielr...@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 Rielr...@redhat.com --- drivers/base/cpu.c | 17 + 1 file changed, 17 insertions(+) In the arch/tile distribution with our dataplane support, we have traditionally had a /sys/devices/system/cpu/dataplane file with the same semantics you are proposing. It's definitely helpful to userspace applications figuring out how to appropriately take over the machine they are being run on. Acked-by: Chris Metcalf cmetc...@ezchip.com -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] show nohz_full cpus in sysfs
From: Rik van Riel 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 --- 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 #include #include +#include #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[] = { _attr_kernel_max.attr, _attr_offline.attr, _attr_isolated.attr, +#ifdef CONFIG_NO_HZ_FULL + _attr_nohz_full.attr, +#endif #ifdef CONFIG_GENERIC_CPU_AUTOPROBE _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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] show nohz_full cpus in sysfs
From: Rik van Riel r...@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 r...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Sat, Mar 28, 2015 at 12:15:56PM -0400, Rik van Riel wrote: > On 03/28/2015 12:02 PM, Frederic Weisbecker wrote: > > 2015-03-27 22:50 GMT+01:00 : > >> From: Rik van Riel > >> > >> Currently there is no way to query which CPUs are in nohz_full > >> mode from userspace. > > > > Well you can watch dmesg | grep NO_HZ > > But surely sysfs is more convenient from an app. > > > > I guess it's ok, as long as it's strictly Read Only. Here it seems to > > be the case. And it's not chmod'able, right? > > I followed the other code for files in that directory. > > Quick testing shows that the cpu info files in > /sys/devices/system/cpu are chmoddable, but writing > to them fails with -EIO because there is no function > set up to handle writes. So yeah, read only :) Perfect :-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 03/28/2015 12:02 PM, Frederic Weisbecker wrote: > 2015-03-27 22:50 GMT+01:00 : >> From: Rik van Riel >> >> Currently there is no way to query which CPUs are in nohz_full >> mode from userspace. > > Well you can watch dmesg | grep NO_HZ > But surely sysfs is more convenient from an app. > > I guess it's ok, as long as it's strictly Read Only. Here it seems to > be the case. And it's not chmod'able, right? I followed the other code for files in that directory. Quick testing shows that the cpu info files in /sys/devices/system/cpu are chmoddable, but writing to them fails with -EIO because there is no function set up to handle writes. So yeah, read only :) -- All rights reversed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
2015-03-27 22:50 GMT+01:00 : > From: Rik van Riel > > Currently there is no way to query which CPUs are in nohz_full > mode from userspace. Well you can watch dmesg | grep NO_HZ But surely sysfs is more convenient from an app. I guess it's ok, as long as it's strictly Read Only. Here it seems to be the case. And it's not chmod'able, right? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Sat, 2015-03-28 at 09:35 -0400, Rik van Riel wrote: > It can be used by programs like irqbalance to avoid binding IRQs > to isolated or nohz_full CPUs, by libvirt to know which CPUs do > not get load balancing of SCHED_OTHER tasks, etc... Ok, other system packages learning to avoid these does make good sense. -Mike -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 03/28/2015 12:18 AM, Mike Galbraith wrote: > On Fri, 2015-03-27 at 17:50 -0400, r...@redhat.com wrote: >> From: Rik van Riel >> >> Currently there is no way to query which CPUs are in nohz_full >> mode from userspace. > > Hm, they're both (as of your last set) invariant. So are most of the others in /sys/device/system/cpu That does not make it less useful to discover what the system setup turned out to be after boot. > Is this so an HPC app > can automatically bind itself or something? You can't have more than > one such app, or rather if you did, they'd need more than which CPUs are > HPC capable, they'd need occupancy too, so the query mechanism seems > kinda useless. Box driver has to allocate CPUs, and presumably knows > the configuration of the box (those who don't become ex box drivers). Knowing what system you bought does not reduce the usefulness of /proc/cpuinfo. The CPUs that actually end up isolated or nohz_full can differ from what was specified on the kernel commandline, and being able to see which CPUs ended up in the desired state seems useful. It can be used by programs like irqbalance to avoid binding IRQs to isolated or nohz_full CPUs, by libvirt to know which CPUs do not get load balancing of SCHED_OTHER tasks, etc... -- All rights reversed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 03/28/2015 12:18 AM, Mike Galbraith wrote: On Fri, 2015-03-27 at 17:50 -0400, r...@redhat.com wrote: From: Rik van Riel r...@redhat.com Currently there is no way to query which CPUs are in nohz_full mode from userspace. Hm, they're both (as of your last set) invariant. So are most of the others in /sys/device/system/cpu That does not make it less useful to discover what the system setup turned out to be after boot. Is this so an HPC app can automatically bind itself or something? You can't have more than one such app, or rather if you did, they'd need more than which CPUs are HPC capable, they'd need occupancy too, so the query mechanism seems kinda useless. Box driver has to allocate CPUs, and presumably knows the configuration of the box (those who don't become ex box drivers). Knowing what system you bought does not reduce the usefulness of /proc/cpuinfo. The CPUs that actually end up isolated or nohz_full can differ from what was specified on the kernel commandline, and being able to see which CPUs ended up in the desired state seems useful. It can be used by programs like irqbalance to avoid binding IRQs to isolated or nohz_full CPUs, by libvirt to know which CPUs do not get load balancing of SCHED_OTHER tasks, etc... -- All rights reversed -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Sat, 2015-03-28 at 09:35 -0400, Rik van Riel wrote: It can be used by programs like irqbalance to avoid binding IRQs to isolated or nohz_full CPUs, by libvirt to know which CPUs do not get load balancing of SCHED_OTHER tasks, etc... Ok, other system packages learning to avoid these does make good sense. -Mike -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
2015-03-27 22:50 GMT+01:00 r...@redhat.com: From: Rik van Riel r...@redhat.com Currently there is no way to query which CPUs are in nohz_full mode from userspace. Well you can watch dmesg | grep NO_HZ But surely sysfs is more convenient from an app. I guess it's ok, as long as it's strictly Read Only. Here it seems to be the case. And it's not chmod'able, right? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On 03/28/2015 12:02 PM, Frederic Weisbecker wrote: 2015-03-27 22:50 GMT+01:00 r...@redhat.com: From: Rik van Riel r...@redhat.com Currently there is no way to query which CPUs are in nohz_full mode from userspace. Well you can watch dmesg | grep NO_HZ But surely sysfs is more convenient from an app. I guess it's ok, as long as it's strictly Read Only. Here it seems to be the case. And it's not chmod'able, right? I followed the other code for files in that directory. Quick testing shows that the cpu info files in /sys/devices/system/cpu are chmoddable, but writing to them fails with -EIO because there is no function set up to handle writes. So yeah, read only :) -- All rights reversed -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Sat, Mar 28, 2015 at 12:15:56PM -0400, Rik van Riel wrote: On 03/28/2015 12:02 PM, Frederic Weisbecker wrote: 2015-03-27 22:50 GMT+01:00 r...@redhat.com: From: Rik van Riel r...@redhat.com Currently there is no way to query which CPUs are in nohz_full mode from userspace. Well you can watch dmesg | grep NO_HZ But surely sysfs is more convenient from an app. I guess it's ok, as long as it's strictly Read Only. Here it seems to be the case. And it's not chmod'able, right? I followed the other code for files in that directory. Quick testing shows that the cpu info files in /sys/devices/system/cpu are chmoddable, but writing to them fails with -EIO because there is no function set up to handle writes. So yeah, read only :) Perfect :-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Fri, 2015-03-27 at 17:50 -0400, r...@redhat.com wrote: > From: Rik van Riel > > Currently there is no way to query which CPUs are in nohz_full > mode from userspace. Hm, they're both (as of your last set) invariant. Is this so an HPC app can automatically bind itself or something? You can't have more than one such app, or rather if you did, they'd need more than which CPUs are HPC capable, they'd need occupancy too, so the query mechanism seems kinda useless. Box driver has to allocate CPUs, and presumably knows the configuration of the box (those who don't become ex box drivers). -Mike -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] show nohz_full cpus in sysfs
From: Rik van Riel 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 --- 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 #include #include +#include #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[] = { _attr_kernel_max.attr, _attr_offline.attr, _attr_isolated.attr, +#ifdef CONFIG_NO_HZ_FULL + _attr_nohz_full.attr, +#endif #ifdef CONFIG_GENERIC_CPU_AUTOPROBE _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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] show nohz_full cpus in sysfs
From: Rik van Riel r...@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 r...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] show nohz_full cpus in sysfs
On Fri, 2015-03-27 at 17:50 -0400, r...@redhat.com wrote: From: Rik van Riel r...@redhat.com Currently there is no way to query which CPUs are in nohz_full mode from userspace. Hm, they're both (as of your last set) invariant. Is this so an HPC app can automatically bind itself or something? You can't have more than one such app, or rather if you did, they'd need more than which CPUs are HPC capable, they'd need occupancy too, so the query mechanism seems kinda useless. Box driver has to allocate CPUs, and presumably knows the configuration of the box (those who don't become ex box drivers). -Mike -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/