Re: [vserver] Assigning whole CPUs to contexts

From: Jiri Denemark <jirka_at_ics.muni.cz>
Date: Thu 24 Apr 2008 - 15:45:23 BST
Message-ID: <20080424144523.GA6334@elg.home>

> 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 Kulawiec
Received on Thu Apr 24 23:23:18 2008
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 24 Apr 2008 - 23:23:20 BST by hypermail 2.1.8