Hi, All, As discussed in the previous thread http://article.gmane.org/gmane.comp.lib.libcg.devel/139, we don't have the concept of default groups and tasks should be able to return back to their default group when done.
Here is a fix to the cgconfig script to fix the issue. Please review, comment on it. Signed-off-by: Balbir Singh <[email protected]> Index: scripts/init.d/cgconfig =================================================================== --- scripts/init.d/cgconfig (revision 225) +++ scripts/init.d/cgconfig (working copy) @@ -82,6 +82,56 @@ #log_progress_msg "Starting cgconfig service: " cgconfigparser -l $CONFIG_FILE fi + + declare defaultcgroup + + if [ -f /etc/cgrules.conf ] + then + read user ctrl defaultcgroup <<< \ + `grep -m1 ^\* /etc/cgrules.conf` + if [[ -n $defaultcgroup && $defaultcgroup = "*" ]] + then + log_warning_msg "/etc/cgrules.conf incorrect" + log_warning_msg "Overriding it" + defaultcgroup= + fi + fi + + if [ -z $defaultcgroup ] + then + defaultcgroup=sysdefault/ + fi + # + # Create a default class for tasks to return back to + # + parse_mounts + for i in `seq 1 $maxindex` + do + # + # Ignore if directory already exists + # + mkdir ${MOUNTPOINT[$i]}/$defaultcgroup 2> /dev/null + chmod a+rw ${MOUNTPOINT[$i]}/$defaultcgroup/tasks + # + # special rule for cpusets + # + echo ${MOUNTOPTS[$i]} | grep -q -w cpuset + if [ $? -eq 0 ] + then + cat ${MOUNTPOINT[$i]}/cpuset.cpus > \ + ${MOUNTPOINT[$i]}/$defaultcgroup/cpuset.cpus + cat ${MOUNTPOINT[$i]}/cpuset.mems > \ + ${MOUNTPOINT[$i]}/$defaultcgroup/cpuset.mems + fi + # + # classify everything to default cgroup + # + for j in `ps --no-headers -eL o tid` + do + echo $j > ${MOUNTPOINT[$i]}/$defaultcgroup/tasks 2>/dev/null + done + done + [ $? == 0 ] && touch /var/lock/subsys/$servicename return $? } -- Balbir ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
