Limit RAM and CPUs for Chromium (browsers) with cgroups

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











up vote
0
down vote

favorite












sometimes my Chromium eats a lot of RAM and CPUs. I would like to limit its processes. I read how to do it with cgroup managing in Arch and RedHat wiki pages and some other sites. According that I configured my:



$ cat /etc/cgconfig.conf 
mount
cpu = /sys/fs/cgroup/browsers;
cpuacct = /sys/fs/cgroup/browsers;
memory = /sys/fs/cgroup/browsers;


group browsers
# perm
# # Who can manage limits
# admin
# uid = root;
# gid = users;
#
# # Who can add tasks to this group
# task
# uid = waldauf;
# gid = users;
#
#
cpu
# # Set the relative share of CPU resources equal to 25%
cpu.shares = "256";

# # Use max 4 CPUs at time
# cpuset
# cpuset.cpus="0-4"
#
cpuacct
cpuacct.usage="0";

memory
# # Allocate at most 1 GB of memory to tasks
memory.limit_in_bytes = "8G";
# # Apply a soft limit of 512 MB to tasks
memory.soft_limit_in_bytes = "6G";




and



$ cat /etc/cgrules.conf
### LIMIT FOR CHROMIUM
# user:process subsystems group
waldauf:/usr/lib/chromium/chromium cpu,memory browsers




When I checked configuration I got this error message:



$ sudo cgconfigparser -l /etc/cgconfig.conf
Error: cannot create directory /sys/fs/cgroup/browsers
cgconfigparser; error loading /etc/cgconfig.conf: Cgroup, operation not allowed


After that I commented mount then parser run alright. I restarted cgconfig.service in systemd. But in /sys/fs/cgroup/ is not created new browsers cgroup.



$ sudo systemctl restart cgconfig.service
$ ll /sys/fs/cgroup
total 0
dr-xr-xr-x 2 root root 0 Oct 27 18:55 blkio/
lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpu -> cpu,cpuacct/
dr-xr-xr-x 3 root root 0 Oct 27 18:55 cpu,cpuacct/
lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpuacct -> cpu,cpuacct/
~




What next I tried:




  • Create cgroup direcotry in system's /tmp directory. But I got:



    sudo cgconfigparser -l /etc/cgconfig.conf
    Error: cannot mount cpu to /tmp/cgroup/browsers: Device or resource busy
    cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed


  • The same error I got createing new tmpfs mount /tmp/cgroup.




Can I ask you for the kick which moves me in the right way? :]










share|improve this question

























    up vote
    0
    down vote

    favorite












    sometimes my Chromium eats a lot of RAM and CPUs. I would like to limit its processes. I read how to do it with cgroup managing in Arch and RedHat wiki pages and some other sites. According that I configured my:



    $ cat /etc/cgconfig.conf 
    mount
    cpu = /sys/fs/cgroup/browsers;
    cpuacct = /sys/fs/cgroup/browsers;
    memory = /sys/fs/cgroup/browsers;


    group browsers
    # perm
    # # Who can manage limits
    # admin
    # uid = root;
    # gid = users;
    #
    # # Who can add tasks to this group
    # task
    # uid = waldauf;
    # gid = users;
    #
    #
    cpu
    # # Set the relative share of CPU resources equal to 25%
    cpu.shares = "256";

    # # Use max 4 CPUs at time
    # cpuset
    # cpuset.cpus="0-4"
    #
    cpuacct
    cpuacct.usage="0";

    memory
    # # Allocate at most 1 GB of memory to tasks
    memory.limit_in_bytes = "8G";
    # # Apply a soft limit of 512 MB to tasks
    memory.soft_limit_in_bytes = "6G";




    and



    $ cat /etc/cgrules.conf
    ### LIMIT FOR CHROMIUM
    # user:process subsystems group
    waldauf:/usr/lib/chromium/chromium cpu,memory browsers




    When I checked configuration I got this error message:



    $ sudo cgconfigparser -l /etc/cgconfig.conf
    Error: cannot create directory /sys/fs/cgroup/browsers
    cgconfigparser; error loading /etc/cgconfig.conf: Cgroup, operation not allowed


    After that I commented mount then parser run alright. I restarted cgconfig.service in systemd. But in /sys/fs/cgroup/ is not created new browsers cgroup.



    $ sudo systemctl restart cgconfig.service
    $ ll /sys/fs/cgroup
    total 0
    dr-xr-xr-x 2 root root 0 Oct 27 18:55 blkio/
    lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpu -> cpu,cpuacct/
    dr-xr-xr-x 3 root root 0 Oct 27 18:55 cpu,cpuacct/
    lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpuacct -> cpu,cpuacct/
    ~




    What next I tried:




    • Create cgroup direcotry in system's /tmp directory. But I got:



      sudo cgconfigparser -l /etc/cgconfig.conf
      Error: cannot mount cpu to /tmp/cgroup/browsers: Device or resource busy
      cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed


    • The same error I got createing new tmpfs mount /tmp/cgroup.




    Can I ask you for the kick which moves me in the right way? :]










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      sometimes my Chromium eats a lot of RAM and CPUs. I would like to limit its processes. I read how to do it with cgroup managing in Arch and RedHat wiki pages and some other sites. According that I configured my:



      $ cat /etc/cgconfig.conf 
      mount
      cpu = /sys/fs/cgroup/browsers;
      cpuacct = /sys/fs/cgroup/browsers;
      memory = /sys/fs/cgroup/browsers;


      group browsers
      # perm
      # # Who can manage limits
      # admin
      # uid = root;
      # gid = users;
      #
      # # Who can add tasks to this group
      # task
      # uid = waldauf;
      # gid = users;
      #
      #
      cpu
      # # Set the relative share of CPU resources equal to 25%
      cpu.shares = "256";

      # # Use max 4 CPUs at time
      # cpuset
      # cpuset.cpus="0-4"
      #
      cpuacct
      cpuacct.usage="0";

      memory
      # # Allocate at most 1 GB of memory to tasks
      memory.limit_in_bytes = "8G";
      # # Apply a soft limit of 512 MB to tasks
      memory.soft_limit_in_bytes = "6G";




      and



      $ cat /etc/cgrules.conf
      ### LIMIT FOR CHROMIUM
      # user:process subsystems group
      waldauf:/usr/lib/chromium/chromium cpu,memory browsers




      When I checked configuration I got this error message:



      $ sudo cgconfigparser -l /etc/cgconfig.conf
      Error: cannot create directory /sys/fs/cgroup/browsers
      cgconfigparser; error loading /etc/cgconfig.conf: Cgroup, operation not allowed


      After that I commented mount then parser run alright. I restarted cgconfig.service in systemd. But in /sys/fs/cgroup/ is not created new browsers cgroup.



      $ sudo systemctl restart cgconfig.service
      $ ll /sys/fs/cgroup
      total 0
      dr-xr-xr-x 2 root root 0 Oct 27 18:55 blkio/
      lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpu -> cpu,cpuacct/
      dr-xr-xr-x 3 root root 0 Oct 27 18:55 cpu,cpuacct/
      lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpuacct -> cpu,cpuacct/
      ~




      What next I tried:




      • Create cgroup direcotry in system's /tmp directory. But I got:



        sudo cgconfigparser -l /etc/cgconfig.conf
        Error: cannot mount cpu to /tmp/cgroup/browsers: Device or resource busy
        cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed


      • The same error I got createing new tmpfs mount /tmp/cgroup.




      Can I ask you for the kick which moves me in the right way? :]










      share|improve this question













      sometimes my Chromium eats a lot of RAM and CPUs. I would like to limit its processes. I read how to do it with cgroup managing in Arch and RedHat wiki pages and some other sites. According that I configured my:



      $ cat /etc/cgconfig.conf 
      mount
      cpu = /sys/fs/cgroup/browsers;
      cpuacct = /sys/fs/cgroup/browsers;
      memory = /sys/fs/cgroup/browsers;


      group browsers
      # perm
      # # Who can manage limits
      # admin
      # uid = root;
      # gid = users;
      #
      # # Who can add tasks to this group
      # task
      # uid = waldauf;
      # gid = users;
      #
      #
      cpu
      # # Set the relative share of CPU resources equal to 25%
      cpu.shares = "256";

      # # Use max 4 CPUs at time
      # cpuset
      # cpuset.cpus="0-4"
      #
      cpuacct
      cpuacct.usage="0";

      memory
      # # Allocate at most 1 GB of memory to tasks
      memory.limit_in_bytes = "8G";
      # # Apply a soft limit of 512 MB to tasks
      memory.soft_limit_in_bytes = "6G";




      and



      $ cat /etc/cgrules.conf
      ### LIMIT FOR CHROMIUM
      # user:process subsystems group
      waldauf:/usr/lib/chromium/chromium cpu,memory browsers




      When I checked configuration I got this error message:



      $ sudo cgconfigparser -l /etc/cgconfig.conf
      Error: cannot create directory /sys/fs/cgroup/browsers
      cgconfigparser; error loading /etc/cgconfig.conf: Cgroup, operation not allowed


      After that I commented mount then parser run alright. I restarted cgconfig.service in systemd. But in /sys/fs/cgroup/ is not created new browsers cgroup.



      $ sudo systemctl restart cgconfig.service
      $ ll /sys/fs/cgroup
      total 0
      dr-xr-xr-x 2 root root 0 Oct 27 18:55 blkio/
      lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpu -> cpu,cpuacct/
      dr-xr-xr-x 3 root root 0 Oct 27 18:55 cpu,cpuacct/
      lrwxrwxrwx 1 root root 11 Oct 27 18:55 cpuacct -> cpu,cpuacct/
      ~




      What next I tried:




      • Create cgroup direcotry in system's /tmp directory. But I got:



        sudo cgconfigparser -l /etc/cgconfig.conf
        Error: cannot mount cpu to /tmp/cgroup/browsers: Device or resource busy
        cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed


      • The same error I got createing new tmpfs mount /tmp/cgroup.




      Can I ask you for the kick which moves me in the right way? :]







      linux cgroups






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 16 mins ago









      waldauf

      6016




      6016

























          active

          oldest

          votes











          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f478143%2flimit-ram-and-cpus-for-chromium-browsers-with-cgroups%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478143%2flimit-ram-and-cpus-for-chromium-browsers-with-cgroups%23new-answer', 'question_page');

          );

          Post as a guest













































































          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?