Re: [PATCH -mmotm 3/3] memcg: remove memcg_tasklist

Balbir Singh
2009-11-11T16:01:42Z

* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2009-11-11 10:39:06]:

> memcg_tasklist was introduced at commit 7f4d454d(memcg: avoid deadlock caused
> by race between oom and cpuset_attach) instead of cgroup_mutex to fix a deadlock
> problem. The cgroup_mutex, which was removed by the commit, in
> mem_cgroup_out_of_memory() was originally introduced at commit c7ba5c9e
> (Memory controller: OOM handling).
>
> IIUC, the intention of this cgroup_mutex was to prevent task move during
> select_bad_process() so that situations like below can be avoided.
>
> Assume cgroup "foo" has exceeded its limit and is about to trigger oom.
> 1. Process A, which has been in cgroup "baa" and uses large memory, is just
> moved to cgroup "foo". Process A can be the candidates for being killed.
> 2. Process B, which has been in cgroup "foo" and uses large memory, is just
> moved from cgroup "foo". Process B can be excluded from the candidates for
> being killed.
>
> But these race window exists anyway even if we hold a lock, because
> __mem_cgroup_try_charge() decides wether it should trigger oom or not outside
> of the lock. So the original cgroup_mutex in mem_cgroup_out_of_memory and thus
> current memcg_tasklist has no use. And IMHO, those races are not so critical
> for users.
>
> This patch removes it and make codes simpler.
>

Could you please test for side-effects like concurrent OOM. An idea of
how the patchset was tested would be good to have, given the
implications of these changes.

Not-Yet-Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>

--
Balbir