Skip to contentSkip to conversation

pci cpumask: remove local cpumask_t's from the stack

PATCH In review Mike Travis 3 participants 6 messages Jan 5, 2009 – Jan 6, 2009 PCI

lore
Share & tools
lore
#0 lore raw

cover pci cpumask: remove local cpumask_t's from the stack

Rebased against linux-next/master (v2.6.28-rc8-5814-g8dba8f5)>

*** Note these are also in tip/cpus4096 at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
branch: cpus4096

588235b: cpumask: update pci_bus_show_cpuaffinity to use new cpumask API 3be8305: cpumask: update local_cpus_show to use new cpumask API

(Perhaps "git-pulling" them from there is a better method?)

#1 lore raw

PATCH 1/2 cpumask: update local_cpus_show to use new cpumask API

Impact: cleanup, reduce stack usage, use new cpumask API.

Replace the local cpumask_t variable with a pointer to the const cpumask that needs to be printed.

---
 drivers/pci/pci-sysfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/pci-sysfs.c +6 -6
@@ -70,11 +70,11 @@ static ssize_t broken_parity_status_stor
 static ssize_t local_cpus_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {		
-	cpumask_t mask;
+	const struct cpumask *mask;
 	int len;
 
-	mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
-	len = cpumask_scnprintf(buf, PAGE_SIZE-2, &mask);
+	mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+	len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
 	buf[len++] = '\n';
 	buf[len] = '\0';
 	return len;
@@ -84,11 +84,11 @@ static ssize_t local_cpus_show(struct de
 static ssize_t local_cpulist_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	cpumask_t mask;
+	const struct cpumask *mask;
 	int len;
 
-	mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
-	len = cpulist_scnprintf(buf, PAGE_SIZE-2, &mask);
+	mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+	len = cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
 	buf[len++] = '\n';
 	buf[len] = '\0';
 	return len;
#2 lore raw

Re: [PATCH 1/2] cpumask: update local_cpus_show to use new cpumask API

Quoted 10 lines · Mike Travis

Impact: cleanup, reduce stack usage, use new cpumask API.

Replace the local cpumask_t variable with a pointer to the const cpumask that needs to be printed.

---
 drivers/pci/pci-sysfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Hm, clearly there are other patches in Ingo's tree that this depends on, since this patch assumes the presence of cpumask_of_pcibus and has slightly different cpumask_scnprintf context. I'll just let Ingo push the whole thing.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#3 lore raw

Re: [PATCH 1/2] cpumask: update local_cpus_show to use new cpumask API

Quoted 12 lines · Jesse Barnes
Quoted 10 lines · Mike Travis

Impact: cleanup, reduce stack usage, use new cpumask API.

Replace the local cpumask_t variable with a pointer to the const cpumask that needs to be printed.

---
 drivers/pci/pci-sysfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 4 lines

Hm, clearly there are other patches in Ingo's tree that this depends on, since this patch assumes the presence of cpumask_of_pcibus and has slightly different cpumask_scnprintf context. I'll just let Ingo push the whole thing.

Ok, thanks. I saw that but I *think* all of this is in Linus' tree.

Cheers,
Mike

#4 lore raw

Re: [PATCH 1/2] cpumask: update local_cpus_show to use new cpumask API

In reply to Jesse Barnes
Quoted 12 lines · Jesse Barnes
Quoted 10 lines · Mike Travis

Impact: cleanup, reduce stack usage, use new cpumask API.

Replace the local cpumask_t variable with a pointer to the const cpumask that needs to be printed.

---
 drivers/pci/pci-sysfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 4 lines

Hm, clearly there are other patches in Ingo's tree that this depends on, since this patch assumes the presence of cpumask_of_pcibus and has slightly different cpumask_scnprintf context. I'll just let Ingo push the whole thing.

okay, will push them to Linus.

Ingo

#5 lore raw

PATCH 2/2 cpumask: update pci_bus_show_cpuaffinity to use new cpumask API

In reply to Mike Travis

Impact: cleanup, reduce stack usage, use new cpumask API.

Replace the local cpumask_t variable with a pointer to the const cpumask that needs to be printed.

---
 drivers/pci/probe.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/probe.c +4 -4
@@ -51,12 +51,12 @@ static ssize_t pci_bus_show_cpuaffinity(
 					char *buf)
 {
 	int ret;
-	cpumask_t cpumask;
+	const struct cpumask *cpumask;
 
-	cpumask = pcibus_to_cpumask(to_pci_bus(dev));
+	cpumask = cpumask_of_pcibus(to_pci_bus(dev));
 	ret = type?
-		cpulist_scnprintf(buf, PAGE_SIZE-2, &cpumask) :
-		cpumask_scnprintf(buf, PAGE_SIZE-2, &cpumask);
+		cpulist_scnprintf(buf, PAGE_SIZE-2, cpumask) :
+		cpumask_scnprintf(buf, PAGE_SIZE-2, cpumask);
 	buf[ret++] = '\n';
 	buf[ret] = '\0';
 	return ret;