Messages in this thread | | | From | Paul Menage <> | Date | Fri, 24 Jun 2011 15:22:11 -0700 | Subject | Re: [RFC PATCH 4/4] cgroups: Add an rlimit subsystem |
| |
On Thu, Jun 23, 2011 at 6:48 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote: >> Can't this fail spuriously in the presence of hierarchies? >> >> E.g. if cgroup A has children, and A is at its limit, then moving >> tasks around between A and its children, or between different children >> of A, seems like it would fail due to the temporary double counting. > > Good point. Probably I should first uncharge the old cgroup and its parents. >
That can fail too - if a new task gets created between the uncharge and the charge.
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
| |