echo $$ > tasks gives "no space left on device" when trying to use cpuset
Asked Answered
D

1

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?

Declarative answered 5/2, 2015 at 16:6 Comment(0)
G
24

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.

Gaffer answered 5/2, 2015 at 22:47 Comment(5)
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.Declarative
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.Gaffer
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. :-(Declarative
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/tasksGaffer
Great! Thank you man, that was exactly my problem! Nobody could expect that in "cpu" section I must set something related to memory...Krakau

© 2022 - 2024 — McMap. All rights reserved.