Multicore laptops and turning off CPU cores

Holger Macht hmacht at suse.de
Thu Aug 17 10:28:49 PDT 2006


On Thu 17. Aug - 18:05:45, Richard Hughes wrote:
> Now we are playing with cpu frequency scaling, it would make sense in my
> opinion to expose a OS neutral API to offline and online CPU's.
> 
> I think it was Daniel Drake (post beers) who showed me how to do this at
> GUADEC by just echoing a value somewhere in sysfs for his new shiny
> dual-core laptop.
> He also showed me this *dramatically* reduced the power usage of the
> laptop.

Well, offlining one CPU just puts it into C4 state. This is what the
kernel should select anyway if the system is idle.

> 
> I think it went something like this:
> echo 0 > /sys/devices/system/cpu/cpuX/online
> 
> This is Linux specific, but we can add Solaris and *BSD support easily.
> Artem, Joe, what are the commands?
> 
> I'm guessing that a dual core laptop appears as two processor objects in
> HAL, in which case it makes it trivial to add methods:
> 
> void org.freedesktop.Hal.Device.ProcessorHotplug.SetOnline(bool)
> bool org.freedesktop.Hal.Device.ProcessorHotplug.GetOnline(void)
> 
> This scheme wouldn't be possible if the processor object disappears from
> the HAL device tree which I don't think it does. Daniel can you confirm
> please?
> 
> Note: we can see if a CPU is "offlineable" by the presence of the
> file /sys/devices/system/cpu/cpuX/online - if it does not exist then you
> can't offline it, and we shouldn't add the methods or the capability
> 'processor_hotplug'.
> 
> Better interface, capability and method names welcome. :-)
> 
> Now, I'm imagining this being used on dual core laptops, but the
> interface shouldn't rule out other machines, such as insanely big SMP
> servers with x CPU's.
> 
> Sound sane / insane? Imagine a checkbox in a typical policy agent
> preferences program (heh):
> 
> When on battery power:
> 
> [x] Turn off additional processors
> 
> Now, that would ROCK.
> 
> Opinions and comments please.

I think it doesn't rock that much ;-)

With offlining a CPU, you just force it into C4. That's the same problem
like with the powersave governor which forces the CPU to lowest possible
freuquency. One could argue that you always want to have a job done as
fast as possible and afterwards go to C4 or lower the frequency.

We also have that feature in powersaved already, and it should be really
easy to implement. So I would say, go for it, and we can drop it from
powersaved. If one might then actually use it in an applet remains open.

<exaggerated>
A kde applet might want it, a gnome applet not ;-)
</exaggerated>


Regards,
	Holger

P.S.: The cpufreq-addon is CPU hotplug save. 


More information about the hal mailing list