2

There are 32 cores in a system (2 cpus each 16 cores) and I want to limit a user to use only 4 cores (100% usage for that 4 cores). There are two kernel parameter for that according to the manuals: cpu.cfs_quota_us and cpu.cfs_period_us

An example on the kernel.org document says:

   With 500ms period and 1000ms quota, the group
   can get 2 CPUs worth of runtime every 500ms.
   # echo 1000000 > cpu.cfs_quota_us /* quota = 1000ms */
   # echo 500000 > cpu.cfs_period_us /* period = 500ms */

I want to know how those ms are determined? In my case, I think the quota is 32000000 and the period is 4000000. Am I right? The content of etc/cgconfig.conf is:

group ansys {
  cpu {
    cpu.cfs_quota_us = 32000000;
    cpu.cfs_period_us = 4000000;
  }
  memory {
    memory.limit_in_bytes = 8000m;
  }
}

But it doesn't work! and I get an error when I run /etc.init.d.cgconfig start, I get this error:

Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d
[FAILED]Starting cgconfig service: /sbin/cgconfigparser; error loading
/etc/cgconfig.conf: Failed to remove a non-empty group
  • I updated the post – mahmood Mar 22 '16 at 14:29
0

Have a look at cpuset cgroup/container parameter. It lets you pin containers to specific cpu cores. In your case, you can specify only a single container to cores 0-3, and let no other container execute on the same core, there by allowing 4 cores with 100% utilization per container.

Furthermore cpuset is a more effective distribution mechanism when compared to cpu (that uses shares/quota).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.