Linux Limiting or restricting SMP CPU activation in SMP mode
Q. I would like to restrict number of CPU activated for some software licensing issues under Linux kernel 2.6.xx.. How can I limit the number of CPUs activated in SMP mode?
A. Pass a special parameter called maxcpus to kernel. It specify maximum number of processors that an SMP Linux kernel should make use of. For example if you have four cpus and would like to use 2 CPU then pass 2 as a number to maxcpus.
maxcpus=NUMBER
This is useful to test different software performances and configurations. Some commercial software such as ERP software or Oracle are licenced per CPU. In such a case maxcpus is a life saver.
Edit your grub.conf file:
# vi grub.conf
Append parameter maxcpus at the end of Kernel line. A the end it should read as follows:
kernel /boot/vmlinuz-2.6.13-Ora10g root=/dev/sda1 ro maxcpus=2
Save and close the file. Reboot system:
# reboot
Alternatively, you need to enter parameter at grub or lilo boot prompt. For example if you are using Grub as a boot loader, at Grub prompt press 'e' to edit command before booting.
- Select second line
- Again, press 'e' to edit selected command
- Select kernel line
- Append maxcpus=2 parameters.
- Press b to boot system
See also:
UPDATED for accuracy.
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- Linux Setting processor affinity for a certain task or process
- Enable permissive mode for SELinux troubleshooting purpose
- FreeBSD > Init to reboot or shutdown system
- Solaris > Boot system into single user mode
- Weird GNOME problem: INIT: Id respawning too fast: disabled for 5 minutes
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: append, boot loader, boot system, cpus, lilo boot, linux kernel, maximum number, reboot system, smp linux


Recent Comments
Today ~ 12 Comments
Today ~ 6 Comments
Today ~ 21 Comments
Today ~ 1 Comment
Today ~ 1 Comment