public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Paul Menage <menage@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Li Zefan <lizf@cn.fujitsu.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Aditya Kali <adityakali@google.com>
Subject: Re: [PATCH 2/7] cgroups: New resource counter inheritance API
Date: Wed, 13 Jul 2011 14:34:01 +0200	[thread overview]
Message-ID: <20110713123357.GE9201@somewhere> (raw)
In-Reply-To: <CAJniumXEPUkRpLdfnu3g-NPBH_mEKYmov1P6+6m3+SXh9sZCvA@mail.gmail.com>

On Mon, Jul 11, 2011 at 01:41:31PM -0700, Paul Menage wrote:
> On Mon, Jul 11, 2011 at 7:15 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > Provide an API to inherit a counter value from a parent.
> > This can be useful to implement cgroup.clone_children on
> > a resource counter.
> >
> > Still the resources of the children are limited by those
> > of the parent, so this is only to provide a default setting
> > behaviour when clone_children is set.
> >
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> 
> Can't this be just:
> 
> void res_counter_inherit(struct res_counter *counter, int member) {
>   struct res_counter *parent;
>   parent = counter->parent;
>   if (parent)
>     res_counter_write_u64(counter, member,
> res_counter_read_u64(parent, member));
> }
> 
> This is just used at cgroup creation time, right? So the performance
> impact of an extra cli/sti shouldn't matter.

Yeah indeed.
 
> Also, looking at the code res_counter_read_u64() appears to not do any
> locking. I don't recall why I added it like that, but it probably
> ought to do at least an atomic64_read().

It does in 32 bits, using the res counter spinlock.

  reply	other threads:[~2011-07-13 12:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 14:14 [PATCH 0/7] cgroups: New max number of tasks subsystem (was: cgroups rlim subsystem) Frederic Weisbecker
2011-07-11 14:15 ` [PATCH 1/7] cgroups: Add res_counter_write_u64() API Frederic Weisbecker
2011-07-11 20:30   ` Paul Menage
2011-07-11 14:15 ` [PATCH 2/7] cgroups: New resource counter inheritance API Frederic Weisbecker
2011-07-11 20:41   ` Paul Menage
2011-07-13 12:34     ` Frederic Weisbecker [this message]
2011-07-11 14:15 ` [PATCH 3/7] cgroups: Add previous cgroup in can_attach_task/attach_task callbacks Frederic Weisbecker
2011-07-11 20:42   ` Paul Menage
2011-07-11 14:15 ` [PATCH 4/7] cgroups: New cancel_attach_task subsystem callback Frederic Weisbecker
2011-07-26  0:57   ` Paul Menage
2011-07-11 14:15 ` [PATCH 5/7] cgroups: Ability to stop res charge propagation on bounded ancestor Frederic Weisbecker
2011-07-12  0:11   ` KAMEZAWA Hiroyuki
2011-07-13 13:50     ` Frederic Weisbecker
2011-07-26  0:50   ` Paul Menage
2011-07-11 14:15 ` [PATCH 6/7] cgroups: Add res counter common ancestor searching Frederic Weisbecker
2011-07-26  1:05   ` Paul Menage
2011-07-28 14:54     ` Frederic Weisbecker
2011-07-11 14:15 ` [PATCH 7/7] cgroups: Add a max number of tasks subsystem Frederic Weisbecker
2011-07-26  1:17   ` Paul Menage
2011-07-26  1:25     ` Li Zefan
2011-07-28 15:06     ` Frederic Weisbecker
2011-07-11 14:26 ` [PATCH 0/7] cgroups: New max number of tasks subsystem (was: cgroups rlim subsystem) Frederic Weisbecker

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=20110713123357.GE9201@somewhere \
    --to=fweisbec@gmail.com \
    --cc=adityakali@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    /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