Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758303AbbDXVLf (ORCPT ); Fri, 24 Apr 2015 17:11:35 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37334 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932462AbbDXVLc (ORCPT ); Fri, 24 Apr 2015 17:11:32 -0400 Date: Fri, 24 Apr 2015 23:11:29 +0200 From: Frederic Weisbecker To: riel@redhat.com, Peter Zijlstra Cc: linux-kernel@vger.kernel.org, tj@kernel.org, umgwanakikbuti@gmail.com, lizefan@huawei.com, gregkh@linuxfoundation.org Subject: Re: [PATCH 1/2] show isolated cpus in sysfs Message-ID: <20150424211120.GA26965@lerouge> References: <1429903468-11099-1-git-send-email-riel@redhat.com> <1429903468-11099-2-git-send-email-riel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429903468-11099-2-git-send-email-riel@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1972 Lines: 60 On Fri, Apr 24, 2015 at 03:24:27PM -0400, riel@redhat.com wrote: > From: Rik van Riel > > 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 > > This can be used by system management tools like libvirt, > openstack, and others to ensure proper placement of tasks. > > Suggested-by: Li Zefan > Signed-off-by: Rik van Riel This patch should go through Peterz. > --- > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/