> Yes, that can also be changed at run-time. Simply echo the new CPUs/memory
> banks to /dev/cpuset/<name>/{cpus,mems}, and you're set.
Great. Just it's not that easy and it took me some time to figure out how
exactly it has to be done. So I'm writing this for others who would like to
also play with dynamically changing cpusets...
To make all processes already running inside the context honor the new
settings of cpuset/cpus, one has to take all PIDs in cpuset/tasks and re-write
them to the same cpuset/task (which is explained in kernel's
Documentation/cpusets.txt. However the PIDs has to be valid in context from
which they are written back to cpuset/task. That is, they must be written
there either from the context itself or from a special monitoring context #1.
For example, the following ensures immediate effect of the change:
# echo 1 >/dev/cpuset/CS/cpus
# vcontext --create --silent --xid 1 -- bash -c 'for pid in
$(</dev/cpuset/CS/tasks); do echo $pid >/dev/cpuset/CS/tasks; done'
Jirka
-- Any sufficiently advanced bug is indistinguishable from a feature. -- Rich KulawiecReceived on Thu Apr 24 23:23:18 2008