I got bored and decided to try this out today, here's how:
First your gona need a kernel with this option compiled in.
CONFIG_CPUSETS (Under General Setup --->)
I checked debian's smp kernel, and it doesn't have this option set, can't say about any other distro's.
All the documentation you'll need is in Documentation/cpusets.txt in your kernel source.
So let's go:
First mount cpuset
mkdir /dev/cpuset
mount -t cpuset none /dev/cpuset
Then create a profile for one of your cpu's
cd /dev/cpuset
mkdir cpu0
cd cpu0
echo 1 > cpu_exclusive
echo 0 > mems # check cat /dev/cpuset/mems for valid options, I atleast can't set tasks without specifying this.
echo 0 > cpus # 0 here is the first cpu
Now for the sake of this tutorial I'm gona use gnuchess as an example
start gnuchess, and then type go and press enter, then you'll see your cpu jump up to 100% straight away(gkrellm is a nice app to watch both cpu's)
Then do.
echo `pidof gnuchess` > tasks
And watch all the load on one cpu, now to get that load over to the other cpu.
cd /dev/cpuset
mkdir cpu1
cd cpu1
echo 1 > cpu_exclusive
echo 0 > mems
echo 1 > cpus # 1 here is the second cpu.
Then
echo `pidof gnuchess` > tasks
And watch the other one light up!
To add more than one process to the tasks file just do echo `pidof someapp` >> tasks
And to remove a profile use rmdir profilename instead of rm.
Fun eh?
First your gona need a kernel with this option compiled in.
CONFIG_CPUSETS (Under General Setup --->)
I checked debian's smp kernel, and it doesn't have this option set, can't say about any other distro's.
All the documentation you'll need is in Documentation/cpusets.txt in your kernel source.
So let's go:
First mount cpuset
mkdir /dev/cpuset
mount -t cpuset none /dev/cpuset
Then create a profile for one of your cpu's
cd /dev/cpuset
mkdir cpu0
cd cpu0
echo 1 > cpu_exclusive
echo 0 > mems # check cat /dev/cpuset/mems for valid options, I atleast can't set tasks without specifying this.
echo 0 > cpus # 0 here is the first cpu
Now for the sake of this tutorial I'm gona use gnuchess as an example
start gnuchess, and then type go and press enter, then you'll see your cpu jump up to 100% straight away(gkrellm is a nice app to watch both cpu's)
Then do.
echo `pidof gnuchess` > tasks
And watch all the load on one cpu, now to get that load over to the other cpu.
cd /dev/cpuset
mkdir cpu1
cd cpu1
echo 1 > cpu_exclusive
echo 0 > mems
echo 1 > cpus # 1 here is the second cpu.
Then
echo `pidof gnuchess` > tasks
And watch the other one light up!
To add more than one process to the tasks file just do echo `pidof someapp` >> tasks
And to remove a profile use rmdir profilename instead of rm.
Fun eh?





