Skip to contentSkip to conversation

Don't export sched_mc_power_savings in laptops

PATCH In review Mahesh Salgaonkar 2 participants 5 messages Nov 29, 2008 – Dec 1, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't export sched_mc_power_savings in laptops

Fix to prevent sched_mc_power_saving from being exported through sysfs for multicore single socket (Laptop).

CPU core map of the boot cpu should be equal to possible number of cpus for single socket system.

This fix has been developed at FOSS.in kernel workout.

arch/x86/include/asm/topology.h +1 -1
index 4850e4b..4adc830 100644
@@ -239,7 +239,7 @@ struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
 
 #ifdef CONFIG_SMP
-#define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
+#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map,0)) != nr_cpu_ids)
 #define smt_capable()			(smp_num_siblings > 1)
 #endif
 
#1 lore raw
Quoted 16 lines · Mahesh Salgaonkar

Fix to prevent sched_mc_power_saving from being exported through sysfs for multicore single socket (Laptop).

CPU core map of the boot cpu should be equal to possible number of cpus for single socket system.

This fix has been developed at FOSS.in kernel workout.

arch/x86/include/asm/topology.h +0 -0
index 4850e4b..4adc830 100644

arch/x86/include/asm/topology.h struct pci_bus; · line 245

Quoted 8 lines
arch/x86/include/asm/topology.h +1 -1
@@ -239,7 +239,7 @@ struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
 
 #ifdef CONFIG_SMP
-#define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
+#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map,0)) != nr_cpu_ids)
 #define smt_capable()			(smp_num_siblings > 1)
 #endif
 

The sched_mc_power_savings in sysfs does not help on single socket multicore laptops.
The above patch has been tested on dual core laptop and dual socket quad core intel processor based server.

Thanks,
-Mahesh.

#2 lore raw
In reply to Mahesh Salgaonkar
Quoted 15 lines · Mahesh Salgaonkar

Fix to prevent sched_mc_power_saving from being exported through sysfs for multicore single socket (Laptop).

CPU core map of the boot cpu should be equal to possible number of cpus for single socket system.

This fix has been developed at FOSS.in kernel workout.

arch/x86/include/asm/topology.h +0 -0
index 4850e4b..4adc830 100644

arch/x86/include/asm/topology.h struct pci_bus; · line 242

Quoted 5 lines
arch/x86/include/asm/topology.h +1 -1
@@ -239,7 +239,7 @@ struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
 
 #ifdef CONFIG_SMP
-#define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
+#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map,0)) != nr_cpu_ids)

hm, dunno. sched_mc_power_savings should have no effect on single-socket systems, right? So the knob should have no effect.

Ingo

#3 lore raw
Quoted 20 lines · Ingo Molnar
Quoted 17 lines · Mahesh Salgaonkar

Fix to prevent sched_mc_power_saving from being exported through sysfs for multicore single socket (Laptop).

CPU core map of the boot cpu should be equal to possible number of cpus for single socket system.

This fix has been developed at FOSS.in kernel workout.

arch/x86/include/asm/topology.h +0 -0
index 4850e4b..4adc830 100644
@@ -239,7 +239,7 @@ struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
 
Quoted 9 lines

arch/x86/include/asm/topology.h struct pci_bus; · line 245

Quoted 4 lines
arch/x86/include/asm/topology.h +1 -1
 #ifdef CONFIG_SMP
-#define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
+#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map,0)) != nr_cpu_ids)
 

hm, dunno. sched_mc_power_savings should have no effect on single-socket systems, right? So the knob should have no effect.

Ingo

Hi Ingo,

Yes, it will not have any effect but it enables additional code path leading to an overhead in case of single-socket system. This overhead is only if "sched_mc_power_savings = 1", however we are still leaving it to zero (default) and preventing user space from turning it on by mistake.

Thanks,
-Mahesh.

#4 lore raw
Quoted 29 lines · Mahesh Jagannath Salgaonkar
Quoted 26 lines · Ingo Molnar
Quoted 14 lines · Mahesh Salgaonkar

Fix to prevent sched_mc_power_saving from being exported through sysfs for multicore single socket (Laptop).
CPU core map of the boot cpu should be equal to possible
number
of cpus for single socket system.
This fix has been developed at FOSS.in kernel workout.
Signed-off-by: Mahesh Salgaonkar
<[email protected]>

arch/x86/include/asm/topology.h +0 -0
index 4850e4b..4adc830 100644

arch/x86/include/asm/topology.h struct pci_bus; · line 242

Quoted 5 lines
arch/x86/include/asm/topology.h +1 -1
@@ -239,7 +239,7 @@ struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
  #ifdef CONFIG_SMP
-#define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
+#define mc_capable()	(cpus_weight(per_cpu(cpu_core_map,0)) != nr_cpu_ids)
 

hm, dunno. sched_mc_power_savings should have no effect on single-socket systems, right? So the knob should have no effect.

Quoted 2 lines

Ingo

Quoted 7 lines

Hi Ingo,

Yes, it will not have any effect but it enables additional code path leading to an overhead in case of single-socket system. This overhead is only if "sched_mc_power_savings = 1", however we are still leaving it to zero (default) and preventing user space from turning it on by mistake.

okay, makes sense - i've applied it to tip/sched/urgent (for v2.6.28 merge), thanks Mahesh!

Ingo