Showing posts with label cpu. Show all posts
Showing posts with label cpu. Show all posts

Thursday, May 27, 2010

How do you find out which cpu a process is running on?

The output of the ps command can be changed to a user defined format by using the -o option.

The following command can be used to display the CPU and the processes assigned.

# ps -eo pid,args,psr

Options:

pid - The process ID of the process.

args - Command with all its arguments as a string.

psr - processor currently assigned to the process.

Go to the man pages for more information on the ps command.

What is kipmi? Why is it taking too much cpu in my Red Hat Enterprise Linux system?

If your IPMI hardware interface does not support interrupts and is a KCS or SMIC interface, the IPMI driver will start a kernel thread for the interface to help speed things up. This is a low-priority kernel thread that constantly polls the IPMI driver while an IPMI operation is in progress.

kipmi is that low-priority kernel thread. If the system does large number of IPMI operations, there is a possibility of kipmi using too much cpu time.

The kipmi thread is a workaround to fix the hardware disability so there is no real fix. Sometimes firmware updates can fix this though.

As a workaround, you can disable kipmi using following steps. This may decrease the speed of IPMI operations though.
* Edit /etc/modprobe.conf and add following entry.

options ipmi_si force_kipmid=0

* Restart the ipmi using following command.

# service ipmi restart

Tuesday, March 10, 2009

How to enable and disable a cpu on a live Linux system?

For squeezing out a bit of extra battery time, I usually disables one of cpus of my laptop.

This option is only available from RHEL5.

I do have two cores in my system.

# grep processor /proc/cpuinfo
processor : 0
processor : 1

/sys/devices/system/cpu/cpuX/online decides if a cpu is enabled or disabled.

# cat /sys/devices/system/cpu/cpu1/online
1


To disable the cpu1:

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


Now only one cpu is up.

# grep processor /proc/cpuinfo
processor : 0


To re-enable the cpu:

# echo 1 > /sys/devices/system/cpu/cpu1/online


I will not be able to disable cpu0. Even online file is not availabe.

# ll /sys/devices/system/cpu/cpu0/
total 0
drwxr-xr-x 5 root root 0 2009-03-10 16:50 cache
drwxr-xr-x 3 root root 0 2009-03-10 16:38 cpufreq
drwxr-xr-x 5 root root 0 2009-03-10 16:50 cpuidle
-r-------- 1 root root 4096 2009-03-10 16:50 crash_notes
drwxr-xr-x 2 root root 0 2009-03-10 16:50 topology


Some architectures (i386, X86_64) does have some special dependency on a certain CPU. I have not tested it in any other architectures.