On Wed, Sep 13, 2017 at 01:46:51PM -0700, David Rientjes wrote: > On Mon, 11 Sep 2017, Roman Gushchin wrote: > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index 15af3da5af02..da2b12ea4667 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -2661,6 +2661,231 @@ static inline bool memcg_has_children(struct mem_cgroup *memcg) > > return ret; > > } > > > > +static long memcg_oom_badness(struct mem_cgroup *memcg, > > + const nodemask_t *nodemask, > > + unsigned long totalpages) > > +{ > > + long points = 0; > > + int nid; > > + pg_data_t *pgdat; > > + > > + /* > > + * We don't have necessary stats for the root memcg, > > + * so we define it's oom_score as the maximum oom_score > > + * of the belonging tasks. > > + */ > > + if (memcg == root_mem_cgroup) { > > + struct css_task_iter it; > > + struct task_struct *task; > > + long score, max_score = 0; > > + > > + css_task_iter_start(&memcg->css, 0, &it); > > + while ((task = css_task_iter_next(&it))) { > > + score = oom_badness(task, memcg, nodemask, > > + totalpages); > > + if (max_score > score) > > score > max_score Ups. Fixed. Thanks! -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html