mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Glyn Normington <gnormington@gopivotal.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Attaching a cgroup subsystem to multiple hierarchies
Date: Thu, 6 Feb 2014 19:59:23 +0100	[thread overview]
Message-ID: <20140206185923.GA2781@dhcp22.suse.cz> (raw)
In-Reply-To: <050BD595-BE55-401D-9B61-E877FB9F06A8@gopivotal.com>

On Wed 05-02-14 14:39:52, Glyn Normington wrote:
> Reading cgroups.txt and casting around the net leads me to believe
> that it is possible to attach a cgroup subsystem (e.g. memory) to
> multiple hierarchies, but this seems to result in “mirrored”
> hierarchies which are automatically kept in step with each other -
> essentially it looks like the same hierarchy at multiple file system
> paths.
> 
> Take the following interaction for example:
> 
> \begin{verbatim}
> $ pwd   
> /home/vagrant
> $ mkdir mem1
> $ mkdir mem2
> $ sudo su
> # mount -t cgroup -o memory none /home/vagrant/mem1
> # mount -t cgroup -o memory none /home/vagrant/mem2
> # cd mem1
> # mkdir inst1  
> # ls inst1 
> cgroup.clone_children  memory.failcnt ...
> # ls ../mem2
> cgroup.clone_children  inst1 memory.limit_in_bytes ...
> # cd inst1
> # echo 1000000 > memory.limit_in_bytes 
> # cat memory.limit_in_bytes 
> 1003520
> # cat ../../mem2/inst1/memory.limit_in_bytes 
> 1003520
> # echo $$ > tasks
> # cat tasks
> 1365
> 1409
> # cat ../../mem2/inst1/tasks
> 1365
> 1411
> 
> Is this working as intended?

Yes, it doesn't make any sense to have two different views on the same
controllers.

> Is there some other way to attach a subsystem to *distinct*
> hierarchies?

No.

> Distinct hierarchies would allow distinct cgroups, distinct settings
> (e.g. memory.limit_in_bytes) and distinct partitions of the tasks in
> the system.

Which one should be applied then?

> 
> Note: I don’t have a good use for this function - I’m simply
> trying to reverse engineer the semantics of cgroups to get a precise
> understanding.

I think there is no need to reverse engineer ;)
Documentation/cgroups/cgroups.txt in the kernel tree does give a decent
description IMO.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2014-02-06 18:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 14:39 Glyn Normington
2014-02-06 18:59 ` Michal Hocko [this message]
2014-02-07  9:21   ` Glyn Normington
2014-02-08  2:26     ` Li Zefan
2014-02-08  8:55       ` Glyn Normington
2014-03-10 13:53       ` Glyn Normington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140206185923.GA2781@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=gnormington@gopivotal.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®