[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Sep 2011 14:31:29 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Paul Menage <paul@...lmenage.org>,
Li Zefan <lizf@...fujitsu.com>,
Johannes Weiner <hannes@...xchg.org>,
Aditya Kali <adityakali@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
Kay Sievers <kay.sievers@...y.org>,
Tim Hockin <thockin@...kin.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 06/12] cgroups: Add res counter common ancestor searching
On Tue, Sep 06, 2011 at 03:21:29PM -0700, Andrew Morton wrote:
> On Tue, 6 Sep 2011 02:13:00 +0200
> Frederic Weisbecker <fweisbec@...il.com> wrote:
>
> > +struct res_counter *
> > +res_counter_common_ancestor(struct res_counter *r1, struct res_counter *r2)
> > +{
> > + struct res_counter *iter;
> > +
> > + while (r1) {
> > + iter = r2;
> > + while (iter) {
> > + if (iter == r1)
> > + return iter;
> > + iter = iter->parent;
> > + }
> > +
> > + r1 = r1->parent;
> > + }
> > +
> > + return NULL;
> > +}
>
> cgroup_mutex, one assumes?
No, a cgroup can't move to other parents, they remain stable
as long as they have children (if I understood correctly).
So this mirrors to res_counters.
In fact res counters is just a library, pretty much like
lists, except they are only used by cgroups for now, so it's up
to the caller to guarantee the stability of its objects.
But yeah the documentation for this function is missing. I'm
adding some comments in the file.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists