Multicore laptops and turning off CPU cores

Richard Hughes hughsient at gmail.com
Thu Aug 17 15:23:33 PDT 2006


On Thu, 2006-08-17 at 19:10 +0100, Daniel Drake wrote:
> 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.
> > 
> > I think it went something like this:
> > echo 0 > /sys/devices/system/cpu/cpuX/online
> 
> I will do more experiments next week, however I'm not so sure about this 
> any more. If I remember right, I am now finding that power usage 
> *increases* when I disable cpu1.
> 
> After our discussion at GUADEC, Patrick Mochel mentioned something in 
> the power management BOF about dual core CPU's doing this in hardware - 
> they power down the extra cores when they aren't being used, or 
> something like that. Adding him to CC.
> 
> > 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?
> 
> Tell me how I can do so and I'll get back to you. I'm moving out to the 
> US on Tuesday (decided as of today!) so things are a little hectic right 
> now.

open hal-device-manager (or run lshal -m) and then offline a CPU and see
if you get a device removed.

> > 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.
> 
> You really need someone to test, but even if this doesn't help on dual 
> core CPU's, it will probably help save power on systems which actually 
> have multiple physical processors. I might be able to test this after I 
> start my internship.

Brilliant, thanks.

Richard.




More information about the hal mailing list