Ok here's a short tutorial:
note: don't copy commands if you don't understand them at least a bit, especially from root!
That being said, go root (sudo su or whatever command you use)
create a folder called cpuset somewhere (in this example in home folder)
# cd /home/username/
# mkdir cpuset
now we mount the cpuset
# mount -t cgroup -o cpuset cpuset /home/username/cpuset/
And we create 2 dirs, one for et and one for all the rest
# cd cpuset
# mkdir et
# mkdir all
# echo 0 > all/cpuset.cpus
# echo 1 > all/cpuset.cpu_exclusive
# echo 0 > all/cpuset.mems
# echo 1 > et/cpuset.cpus
# echo 1 > et/cpuset.cpu_exclusive
# echo 0 > et/cpuset.mems
# echo 0 > et/cpuset.sched_load_balance
# echo 1 > et/cpuset.mem_hardwall
# cat tasks
will list you all the numbers that you'll have to move to the 'all' cpuset. You can move them like this:
# for T in `cat tasks`; do /bin/echo "$T" > all/tasks; done
at this point, a
# cat all/tasks
will show you that all tasks are there, conky (or other cpu monitoring tool) already shows you that only the first core is being used. The cpu usage for the second core is 0. Everything you run now, runs always in cpu0.
At this point run et. Et will be running in the first core as well! So you have to go back to the root terminal and type:
# pgrep -x et.x86
in my case (for example!) the id is 1803
# echo 1803 > et/tasks
now et runs in core 1, and the rest in core 0. Actually,
# ps -eLf | grep et.x86
or htop or top and pressing 'H', give another number as well, because et has another thread running (hopefully I'm not messing with the terminology here)
I usually move that number as well, but I see that it doesn't use much cpu, so maybe it's a mistake to move it as well, let it be in cpu0.
then I also do a:
# renice -n -10 `pgrep -x et.x86`
Et now runs on CPU1 and CPU0 is for the rest. If I want to switch them (for example to avoid overusing only 1 core) I just have to echo the core number as I did at the beginning. ET is already confined to one core so it's quite easy, but pay attention to that 'cpu_exclusive' you cannot move them around if you don't put it to 0 first then to 1 after.
# watch -n 2 cat /proc/interrupts
Shows me that most interrupts run on CPU0, so using core1 for et makes sense. But maybe I should also move the interrupts to core0? Hmm probably it's a bad idea. To remove the cpuset:
- after you exit from et, everything still runs on core0 (!)
Let's move back all tasks
# for T in `cat all/tasks`; do /bin/echo "$T" > tasks; done
# for T in `cat et/tasks`; do /bin/echo "$T" > tasks; done
# cat all/tasks
# cat et/tasks
now empty. Ok. Unmount the cpuset and delete the dir.
# cd ..
# umount /home/username/cpuset/
# rm -r cpuset
If you do it all the time, then a script would be better
It doesn't do miracles, I find the game runs a bit smoother, but maybe it's placebo. Decide yourself if it's worth the effort.