Re: [RFC PATCH 4/4] cgroups: Add an rlimit subsystem

From: Frederic Weisbecker
Date: Tue Jul 05 2011 - 20:22:20 EST


Please keep the Cc list, everybody may has missed your message. I just found
it while browsing randomly my lkml INBOX.

On Tue, Jun 28, 2011 at 05:37:17PM +0000, Aditya Kali wrote:
> Paul Menage <menage <at> google.com> writes:
> > What we need is a res_counter_move_charge(A, B, amount) function which will:
> >
> > - locate C, the nearest common ancestor of A and B
> > - lock up the chain from B up to but not including C, adding the new charge
> > - unlock up the chain from B to C
> > - uncharge along the chain from A up to but not including C (not sure
> > how much locking is needed there since there's no need for roll back).
> >
> > Paul
> >
>
> Another alternative is to use the 'attach' callback in struct cgroup_subsys which
> gets both the old cgroup and the new cgroup as parameters and do
> rlim_remove_proc(old_cgrp) and res_counter_charge(new_cgrp) in this same
> function under the protection of a spinlock.
> It would be good to add a return value to the 'attach' callback too.

But the it would require a global lock, or a per hierarchy one, if you want
to protect against forks and exits. And that wouldn't scale due to these fork/exit
that would take that big lock.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/