RHEL:组的cgroup更改失败

时间:2017-04-25 15:08:54

标签: rhel rhel6 cgroups

当我运行以下命令时,我得到cgroup change of group failed

cgexec --sticky -g *:/throttle some_task

Cgroup throttle在cgconfig.conf中定义,如下所示:

# Configuration file generated by cgsnapshot
mount {
        cpuset = /cgroup/cpuset;
        cpu = /cgroup/cpu;
        cpuacct = /cgroup/cpuacct;
        memory = /cgroup/memory;
        devices = /cgroup/devices;
        freezer = /cgroup/freezer;
        net_cls = /cgroup/net_cls;
        blkio = /cgroup/blkio;
}

group throttle {
        cpu {
                cpu.rt_period_us="1000000";
                cpu.rt_runtime_us="0";
                cpu.cfs_period_us="1000000";
                cpu.cfs_quota_us="500000";
                cpu.shares="1024";
        }
}

group throttle {
        memory {
                memory.memsw.failcnt="0";
                memory.limit_in_bytes="1073741824";
                memory.memsw.max_usage_in_bytes="0";
                memory.move_charge_at_immigrate="0";
                memory.swappiness="60";
                memory.use_hierarchy="0";
                memory.failcnt="0";
                memory.soft_limit_in_bytes="134217728";
                memory.memsw.limit_in_bytes="1073741824";
                memory.max_usage_in_bytes="0";
        }
}

group throttle {
        blkio {
                blkio.throttle.write_iops_device="8:0   10";
                blkio.throttle.read_iops_device="8:0    10";
                blkio.throttle.write_bps_device="";
                blkio.throttle.read_bps_device="";
                blkio.weight="500";
                blkio.weight_device="";
        }
}

我已经进行了广泛的搜索,并且不知道如何开始解决这个问题。这似乎通常与不正确的权限相关联。但是,我没有定义权限(cgroups的文档说这是可选的)。我以root身份运行该流程。

1 个答案:

答案 0 :(得分:0)

想出来。出于某种原因,我的系统上的cgexec不喜欢控制器的通配符(*)。当我按名称列出控制器时,它起作用了:

cgexec --sticky -g "cpu,memory,blkio":/throttle some_task

我系统上cgexec的联机帮助页列出*:<group_name>作为有效语法,但是,我不确定到底发生了什么。无论哪种方式,它都在指定控制器时正常工作。