#! /usr/bin/env bash source "/etc/libvirt/hooks/cpuset.conf" if test -f $CPUSET_REFCOUNT; then ref=$(tail -1 $CPUSET_REFCOUNT) dec=$(expr $ref - 1) printf "%06d" $(expr $dec) > $CPUSET_REFCOUNT if [ $dec -gt 0 ]; then exit 0 fi rm $CPUSET_REFCOUNT else exit 1 fi if test -d ${CPUSET}/${SETNAME}; then sed -un p < ${CPUSET}/${SETNAME}/tasks > ${CPUSET}/tasks rmdir ${CPUSET}/${SETNAME} fi for i in blkio cpu cpuacct cpuset devices freezer memory net_cls perf_event; do rmdir ${CGROUP}/$i/machine/${PARTNAME0}.partition rmdir ${CGROUP}/$i/machine/${PARTNAME1}.partition done /bin/echo ${TOTAL_CORES} > ${CPUSET}/machine/cpuset.cpus # (pgrep kthreadd) = 2 taskset -pc ${TOTAL_CORES} 2