using cpu.cfs_quota_us and cpu.cfs_period_us to limit CPU usage

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















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









share|improve this question
























  • I updated the post

    – mahmood
    Mar 22 '16 at 14:29















0















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









share|improve this question
























  • I updated the post

    – mahmood
    Mar 22 '16 at 14:29













0












0








0








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









share|improve this question
















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






centos linux-kernel cpu quota






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 '16 at 14:29







mahmood

















asked Mar 22 '16 at 11:08









mahmoodmahmood

3702821




3702821












  • I updated the post

    – mahmood
    Mar 22 '16 at 14:29

















  • I updated the post

    – mahmood
    Mar 22 '16 at 14:29
















I updated the post

– mahmood
Mar 22 '16 at 14:29





I updated the post

– mahmood
Mar 22 '16 at 14:29










1 Answer
1






active

oldest

votes


















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).






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f271443%2fusing-cpu-cfs-quota-us-and-cpu-cfs-period-us-to-limit-cpu-usage%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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).






    share|improve this answer



























      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).






      share|improve this answer

























        0












        0








        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).






        share|improve this answer













        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).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 6 '16 at 10:48









        PrashanthPrashanth

        1




        1



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f271443%2fusing-cpu-cfs-quota-us-and-cpu-cfs-period-us-to-limit-cpu-usage%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?