Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to "reserve" a core on a CPU for performance measurement. I have mounted a cpuset cgroups vfs. I created two subgroups like this:

/cpuset.cpu_exclusive    1
/cpuset.cpus             0-3
/cpuset.mems             0

# Everything on the PC except what I want to measure
/All/cpuset.cpu_exclusive    1
/All/cpuset.cpus             1-3
/All/cpuset.mems             0

# The measurement processes only (i.e. the shell + a binary to test)
/Timing/cpuset.cpu_exclusive    1
/Timing/cpuset.cpus             0
/Timing/cpuset.mems             0

I am able to move many processes to the "All" group, but I fail to do so for some (those who look like kernel processes). For instance, ksoftirqd has a pid of 3:

[root@Io:/vfsroot]# echo 3 > All/tasks 
echo: write error: invalid argument

Moreover, for some process I can see them in All/tasks but they'll still be running on the wrong cpu (here cpu #0, with a shell).

[root@Io:/vfsroot]# echo 28362 > All/tasks 
[root@Io:/vfsroot]# ps -eo pid,psr | grep "0$"
...
28362   0

For those I am wondering whether that's because they have not woken up since I changed their cpuset and ps displays the last cpu they ran on...

I can change my current shell cpu quite effectively. (Make it appear and disappear from /Timing/tasks and see it change CPU with ps)

I am using the latest version of Ubuntu and installed cgroups using apt-get if that matters.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.