LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


View Poll Results: I
don't use cgroups. 15 93.75%
use cgroups by configuring them manually, and keep /etc/rc.d/rc.cgconfig -x. 0 0%
configure cgroups via /etc/cgroups.conf and let them get configured by /etc/rc.d/rc.cgconfig. 0 0%
have my own way of doing everything. (I.e. installed systemd, or use cgroups v2, or something else.) 1 6.25%
Voters: 16. You may not vote on this poll

Reply
  Search this Thread
Old 06-02-2019, 12:52 AM   #1
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Rep: Reputation: 253Reputation: 253Reputation: 253
cgroups in rc.S and in rc.cgconfig


Hello, everyone.

I am a bit confused about how cgroups are configured in Slackware.

In rc.S, there are two places where things are done with cgroups:

/etc/rc.d/rc.S
**** Mounts the v1 controllers at lines 51-74
**** Starts cgmanager/cgproxy at lines 375-378
**** Starts libcgroup services at lines 380-384

libcgroup's /etc/cgconfig.conf file permits a mount{ } option, which allows to specify mounts in the config file and manipulate them in runtime (more or less ;-)).

What is the purpose of the lines 51-74 then?

So far I have only found that manual part can parse /proc/cgroups , but those are only v1 controllers, so I'd still think that using the libcgroup interface would be more flexible (and liberating for the main initialization script).

So why does rc.S have to mount cgroups manually?
 
Old 06-02-2019, 06:01 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
My take on this is that cgmanager is obsolete. I have already stated that two years ago:
https://www.linuxquestions.org/quest...ml#post5704374
https://www.linuxquestions.org/questions/slackware-14/[request-for-comments]-do-we-still-need-cgmanager-4175599676/

Just my opinion, of course.
 
Old 06-02-2019, 07:24 PM   #3
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
Quote:
Originally Posted by Didier Spaier View Post
My take on this is that cgmanager is obsolete. I have already stated that two years ago:
https://www.linuxquestions.org/quest...ml#post5704374
https://www.linuxquestions.org/questions/slackware-14/[request-for-comments]-do-we-still-need-cgmanager-4175599676/

Just my opinion, of course.

An experienced opinion is a useful thing.

Libcg didn't have updates since 2014, and neither of them seem to support cgroups v2.

My thinking sketch is here: https://gitlab.com/Lockywolf/linuxbu...ups-manual.txt

If you have suggestions, those are most welcome.
 
1 members found this post helpful.
Old 06-02-2019, 09:24 PM   #4
denydias
Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 297

Rep: Reputation: Disabled
Quote:
Originally Posted by Lockywolf View Post
**** Starts cgmanager/cgproxy at lines 375-378
I use this one as per dockerd requirements.
 
Old 06-03-2019, 02:53 PM   #5
henk2012
Member
 
Registered: Jan 2019
Location: Kunder
Distribution: opensuse 42.3
Posts: 32

Rep: Reputation: Disabled
don't know why i should use it
 
1 members found this post helpful.
Old 06-03-2019, 05:38 PM   #6
philanc
Member
 
Registered: Jan 2011
Posts: 308

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
Originally Posted by henk2012 View Post
don't know why i should use it
I think this is a good question.

I mean, there is plenty literature regarding how cgroups help managing resources between competing containers. But why are all these cgroup controllers mounted by default in Slackware, in rc.S?

Couldn't they be mounted in some rc.d/rc.cgroup script that could be set executable, like other rc scripts, by people actually using them?

Or are they actually always used by default, (independently of any container) by something I don't know?

Last edited by philanc; 06-03-2019 at 05:40 PM. Reason: typo
 
Old 06-03-2019, 08:06 PM   #7
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
Quote:
Originally Posted by philanc View Post
I think this is a good question.

I mean, there is plenty literature regarding how cgroups help managing resources between competing containers. But why are all these cgroup controllers mounted by default in Slackware, in rc.S?

Couldn't they be mounted in some rc.d/rc.cgroup script that could be set executable, like other rc scripts, by people actually using them?

Or are they actually always used by default, (independently of any container) by something I don't know?
If you read the document I posted a link to, you may find some more usages for them, besides containers.

But I don't think they are used by anything in a fresh Slackware installation.
 
Old 06-04-2019, 03:49 AM   #8
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,914

Rep: Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032Reputation: 5032
Quote:
Originally Posted by philanc View Post
I think this ut why are all these cgroup controllers mounted by default in Slackware, in rc.S?

Couldn't they be mounted in some rc.d/rc.cgroup script that could be set executable, like other rc scripts...
Personally, I don't like the idea of splitting more stuff out of rc.S.

There are already examples like rc.loop whose existence is IMO completely unnecessary. Separate rc.* for daemons (services) that need to be stopped/started by admins is perfectly reasonable, but I'm not a fan of splitting out other stuff. I'd much rather see a rc.conf/rc.conf.local mechanism added in order to allow people to configure the behaviour of the main rc scripts without having to hack on them.
 
Old 06-04-2019, 11:09 AM   #9
philanc
Member
 
Registered: Jan 2011
Posts: 308

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
Originally Posted by Lockywolf View Post
If you read the document I posted a link to, you may find some more usages for them, besides containers.
I read your 'Reading-cgroups-manual' document. Very insightful.

Quote:
But I don't think they are used by anything in a fresh Slackware installation.
Yes, this was my core question. I wonder if they are used by some "desktop" stuff I don't know and don't use (polkit, consolekit, others?) -- maybe like you suggest in your document?
 
Old 06-04-2019, 11:24 AM   #10
philanc
Member
 
Registered: Jan 2011
Posts: 308

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
Originally Posted by GazL View Post
Personally, I don't like the idea of splitting more stuff out of rc.S.

There are already examples like rc.loop whose existence is IMO completely unnecessary. Separate rc.* for daemons (services) that need to be stopped/started by admins is perfectly reasonable, but I'm not a fan of splitting out other stuff. I'd much rather see a rc.conf/rc.conf.local mechanism added in order to allow people to configure the behaviour of the main rc scripts without having to hack on them.
Agreed. My main point wasn't to specifically put the cgroup controllers mounting stuff in a rc.d script and only there.

I see in rc.S many optional functions started only some /etc file is there (eg. LVM), or if some rc.d script is executable (eg. FUSE). I was wondering if mounting cgroups controllers was optional or not.

In case it is optional, I think it could be controlled in a similar way (could be an executable rc.d script, some /etc conf file, or as you suggest, in a global rc.conf file.

I hope people routinely using cgroups will contribute to the thread and just tell us what they use them for.

Last edited by philanc; 06-04-2019 at 11:27 AM.
 
Old 06-13-2019, 12:40 AM   #11
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
We have a small problem with libcgroups.

In Slackware's rc.cgconfig, line 106 says:
Code:
                $CGCONFIGPARSER_BIN -l $CONFIG_FILE
Where $CONFIG_FILE is /etc/cgconfig.conf

While, indeed /etc/cgconfig.conf should be loaded by default, as the man page says, there is another default source of configuration which needs to be loaded:

Code:
/etc/cgconfig.d/*.conf
The man pages 'man cgconfigparser' and 'man cgconfig.conf' say it like this:

Code:
etc/cgconfig.d/
              default libcgroup configuration files directory

It would be nice to add this option to -current.

Patch:
Code:
#:diff  rc.cgconfig rc.cgconfig.new 
35a36
> CONFIG_DIR=/etc/cgconfig.d
101,102c102,103
<                 if [ ! -s $CONFIG_FILE ]; then
<                     echo $CONFIG_FILE "is not configured"
---
>                 if [ ! -s $CONFIG_FILE -a ! -e $CONFIG_DIR ]; then
>                     echo $CONFIG_FILE "or" $CONFIG_DIR "is not configured"
106c107
<                 $CGCONFIGPARSER_BIN -l $CONFIG_FILE
---
>                 $CGCONFIGPARSER_BIN -l $CONFIG_FILE -L $CONFIG_DIR
109c110
<                     echo "Failed to parse " $CONFIG_FILE
---
>                     echo "Failed to parse " $CONFIG_FILE or $CONFIG_DIR
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] cgconfig failed sindh Linux - Newbie 1 10-27-2014 01:17 AM
cgroups - tasks in multiple hierarchies and same subsystems selaci Linux - Security 0 10-17-2014 07:44 PM
Cgroups and Systemd omriar Linux - Server 0 10-06-2011 11:15 AM
cgroups spokz Linux - Virtualization and Cloud 3 06-08-2011 05:48 AM
CGROUPs and fair group scheduling AxeMan68 Linux - General 1 04-24-2010 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration