lkml.org 
[lkml]   [2011]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/7] cgroups: New resource counter inheritance API
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.


\
 
 \ /
  Last update: 2011-07-13 14:37    [W:0.985 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site