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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 1 down vote accepted

The cset-shield manpage has this note:

If the optional --kthread=on option is given to the shield command, then all kernel threads (with exception of the per-CPU bound interrupt kernel threads) are also moved to the system set.

I interpret this as "(some) interrupt kernel threads are CPU-bound". From its name, ksoftirqd (kernel soft IRQ daemon) seems a likely candidate! (As a sidenote, I don't think these kernel threads will affect performance measurements.)

share|improve this answer
    
Haven't retried this in a while but that sounds like a good possibility, thanks. – J.N. Feb 17 at 7:56

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.