How to change the number of processors in a 16-core machine

Bill Rugolsky Jr. brugolsky at telemetry-investments.com
Mon Nov 12 14:52:49 UTC 2007


On Mon, Nov 12, 2007 at 09:48:41AM +0000, Rui Tiago Matos wrote:
> On 12/11/2007, Feng Xian <feng.xian at gmail.com> wrote:
> > Hi,
> >
> >  I am doing a scalable test on a 16-core machine (8 dual-core amd
> > processors). So I need to vary the processors from 1 to 16. But I
> > couldnt remove the cores from motherboard. Is there any way to achieve
> > this by changing the max number of processors in the kernel? Thanks!
> 
> >From Documentation/kernel-parameters.txt in a linux source tree:
> 
>         maxcpus=        [SMP] Maximum number of processors that an SMP kernel
>                         should make use of.  maxcpus=n : n >= 0 limits the
>                         kernel to using 'n' processors.  n=0 is a special case,
>                         it is equivalent to "nosmp", which also disables
>                         the IO APIC.
> 
> Just add that parameter on your grub config or directly on the grub shell.

With CPU hotplug, you don't even have to reboot.
See  Documentation/cpu-hotplug.txt:

...

Command Line Switches
---------------------
maxcpus=n    Restrict boot time cpus to n. Say if you have 4 cpus, using
             maxcpus=2 will only boot 2. You can choose to bring the
             other cpus later online, read FAQ's for more info.

additional_cpus=n (*)   Use this to limit hotpluggable cpus. This option sets
                        cpu_possible_map = cpu_present_map + additional_cpus


...

Q: How do i logically offline a CPU?
A: Do the following.

        #echo 0 > /sys/devices/system/cpu/cpuX/online


[echo 1 into the same file to bring it back online.]

Regards,

	Bill Rugolsky




More information about the Fedora-kernel-list mailing list