12

I tried the example from the cpuset(7) manual and created a cpuset Charlie. On both Ubuntu 14.4 LTS and SLES 12 I get the following error when trying to put the current process into the cpuset:

/dev/cpuset/Charlie# echo $$ > tasks

bash: echo: write error: No space left on device

Any help?

Holger Jakobs
  • 984
  • 3
  • 11
  • 32

1 Answers1

23

This usually means that you don't have any memory nodes assigned to the cpuset.

$ cat /dev/cpuset/Charlie/cpuset.mems

would return an empty line. So you can't assign a new task to this cgroup as it will not have any memory to work with.

Assign one or all memory nodes to this cgroup should fix it.

$ echo 0 > /dev/cpuset/Charlie/cpuset.mems

You also need to assign a cpu node as that will also likely be empty.

$ echo 0 > /dev/cpuset/Charlie/cpuset.cpus

Setting cgroup.clone_children to 1 can help in automatically inheriting memory and node setting from parent cgroup when a child cgroup is created.

Rohit Jnagal
  • 1,182
  • 9
  • 8
  • In the example they did echo 1 > cpuset.mems in directory Charlie. But whether it's 0 or 1 - it doesn't work and gives the same error. – Holger Jakobs Feb 06 '15 at 17:07
  • Sorry, incomplete answer. I forgot that what I said for memory is true for cpu too. The cpu mask is also unset. In addition to fixing memory, also add a cpu mask: $ echo 0 > /dev/cpuset/Charlie/cpuset.cpus If both cpuset.cpus and cpuset.mems are non-empty, you will be able to add a task to it. – Rohit Jnagal Feb 09 '15 at 06:31
  • The example I was referring to in the beginning does the following: $ mkdir /dev/cpuset $ mount -t cpuset cpuset /dev/cpuset $ cd /dev/cpuset $ mkdir Charlie $ cd Charlie $ /bin/echo 2-3 > cpuset.cpus $ /bin/echo 1 > cpuset.mems $ /bin/echo $$ > tasks # The current shell is now running in cpuset Charlie # The next line should display '/Charlie' $ cat /proc/self/cpuset So all "echo"s are done, but it still doesn't work. :-( – Holger Jakobs Feb 10 '15 at 07:39
  • hmm, I tried the same commands as you listed here and it worked for me. (on my setup, I had cpus and mems file instead of cpuset.cpus and cpuset.mems). If all the commands succeeded, you can check the state of cpuset cgroup by checking the task file. $ cat /dev/cpuset/Charlie/tasks – Rohit Jnagal Feb 18 '15 at 00:25
  • 1
    Great! Thank you man, that was exactly my problem! Nobody could expect that in "cpu" section I must set something related to memory... – Dmitry K Apr 04 '20 at 15:39