#! /usr/bin/env bash source "/etc/libvirt/hooks/cpuset.conf" if test -f $CPUSET_REFCOUNT; then ref=$(tail -1 $CPUSET_REFCOUNT) printf "%06d" $(expr $ref + 1) > $CPUSET_REFCOUNT exit 0 else printf "%06d" 1 > $CPUSET_REFCOUNT fi /bin/echo ${TOTAL_CORES} > ${CPUSET}/cpuset.cpus /bin/echo ${MEMNODES} > ${CPUSET}/cpuset.mems if test -d ${CPUSET}/machine; then : else mkdir -p ${CPUSET}/machine fi /bin/echo ${TOTAL_CORES} > ${CPUSET}/machine/cpuset.cpus /bin/echo ${MEMNODES} > ${CPUSET}/machine/cpuset.mems if test -d ${CPUSET}/${SETNAME}; then : else mkdir ${CPUSET}/${SETNAME} fi /bin/echo ${HOST_CORES} > ${CPUSET}/${SETNAME}/cpuset.cpus /bin/echo ${MEMNODES} > ${CPUSET}/${SETNAME}/cpuset.mems for i in blkio cpu cpuacct cpuset devices freezer memory net_cls perf_event; do mkdir -p ${CGROUP}/$i/machine/${PARTNAME0}.partition done /bin/echo ${VIRT_CORES0} > ${CPUSET}/machine/${PARTNAME0}.partition/cpuset.cpus /bin/echo ${MEMNODES} > ${CPUSET}/machine/${PARTNAME0}.partition/cpuset.mems for i in `cat ${CPUSET}/tasks`; do /bin/echo ${i} > ${CPUSET}/${SETNAME}/tasks || : done # (pgrep kthreadd) = 2 taskset -pc ${HOST_CORES} 2