Repository navigation
Commit ea280e7
committed
memcg: update memcg_has_children() to use css_next_child()
Currently, memcg_has_children() and mem_cgroup_hierarchy_write()
directly test cgroup->children for list emptiness. It's semantically
correct in traditional hierarchies as it actually wants to test for
any children dead or alive; however, cgroup->children is not a
published field and scheduled to go away.
This patch moves out .use_hierarchy test out of memcg_has_children()
and updates it to use css_next_child() to test whether there exists
any children. With .use_hierarchy test moved out, it can also be used
by mem_cgroup_hierarchy_write().
A side note: As .use_hierarchy is going away, it doesn't really matter
but I'm not sure about how it's used in __memcg_activate_kmem(). The
condition tested by memcg_has_children() is mushy when seen from
userland as its result is affected by dead csses which aren't visible
from userland. I think the rule would be a lot clearer if we have a
dedicated "freshly minted" flag which gets cleared when the first task
is migrated into it or the first child is created and then gate
activation with that.
v2: Added comment noting that testing use_hierarchy is the
responsibility of the callers of memcg_has_children() as suggested
by Michal Hocko.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>1 parent f61c42a commit ea280e7
1 file changed
Lines changed: 21 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4834 | 4834 | | |
4835 | 4835 | | |
4836 | 4836 | | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
4837 | 4843 | | |
4838 | 4844 | | |
4839 | | - | |
| 4845 | + | |
| 4846 | + | |
4840 | 4847 | | |
4841 | | - | |
4842 | | - | |
4843 | | - | |
4844 | | - | |
4845 | | - | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
| 4851 | + | |
4846 | 4852 | | |
4847 | | - | |
4848 | | - | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
4849 | 4859 | | |
4850 | 4860 | | |
4851 | 4861 | | |
| |||
4919 | 4929 | | |
4920 | 4930 | | |
4921 | 4931 | | |
4922 | | - | |
| 4932 | + | |
4923 | 4933 | | |
4924 | 4934 | | |
4925 | 4935 | | |
| |||
5036 | 5046 | | |
5037 | 5047 | | |
5038 | 5048 | | |
5039 | | - | |
| 5049 | + | |
| 5050 | + | |
5040 | 5051 | | |
5041 | 5052 | | |
5042 | 5053 | | |
| |||
0 commit comments