3

我创建了一个“cpu”cgroup:

 $mkdir /dev/cgroup
 $mkdir /dev/cgroup/cpu
 $mount -t cgroup -o cpu cpu /dev/cgroup/cpu
 $cd /dev/cgroup/cpu/
 $mkdir low

现在,我尝试将任务移动到子 cgroup “low”:

 $for task in `cat /dev/cgroup/cpu/tasks`; 
      do   /bin/echo $task > /dev/cgroup/cpu/low/tasks || echo "Failed to move PID $task"; done
 /bin/echo: write error: Invalid argument
 Failed to move PID 3
 /bin/echo: write error: Invalid argument
 Failed to move PID 4
 /bin/echo: write error: Invalid argument
 Failed to move PID 5
 /bin/echo: write error: Invalid argument
 Failed to move PID 6
 /bin/echo: write error: Invalid argument
 Failed to move PID 7
 /bin/echo: write error: Invalid argument
 Failed to move PID 8
 /bin/echo: write error: Invalid argument
 .
 .
 .
 /bin/echo: write error: Invalid argument
 Failed to move PID 58

我能够移动“init”进程本身。但是,我未能移动特定的内核线程:

 root         3     2  0 18:16 ?        00:00:00 [migration/0]
 root         4     2  0 18:16 ?        00:00:00 [sirq-high/0]
 root         5     2  0 18:16 ?        00:00:04 [sirq-timer/0]
 root         6     2  0 18:16 ?        00:00:00 [sirq-net-tx/0]
 root         7     2  0 18:16 ?        00:00:00 [sirq-net-rx/0]
 root         8     2  0 18:16 ?        00:00:00 [sirq-block/0]
 root         9     2  0 18:16 ?        00:00:00 [sirq-block-iopo]
 root        10     2  0 18:16 ?        00:00:00 [sirq-tasklet/0]
 root        11     2  0 18:16 ?        00:00:00 [sirq-sched/0]
 root        12     2  0 18:16 ?        00:00:00 [sirq-hrtimer/0]
 root        13     2  0 18:16 ?        00:00:04 [sirq-rcu/0]
 root        14     2  0 18:16 ?        00:00:00 [watchdog/0]
 root        15     2  0 18:16 ?        00:00:00 [desched/0]
 root        16     2  0 18:16 ?        00:00:00 [migration/1]
 root        17     2  0 18:16 ?        00:00:00 [sirq-high/1]
 root        18     2  0 18:16 ?        00:00:03 [sirq-timer/1]
 root        19     2  0 18:16 ?        00:00:00 [sirq-net-tx/1]
 root        20     2  0 18:16 ?        00:00:00 [sirq-net-rx/1]
 root        21     2  0 18:16 ?        00:00:00 [sirq-block/1]

这些线程有什么特别之处可以防止它们被移动到不同的 cgroup 吗?有什么我想念的吗?

谢谢!艾维。

4

0 回答 0