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

From: Aditya Kali
Date: Tue Jun 28 2011 - 13:47:04 EST


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.



--
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/