The patch titled memcg: fix for hierarchical reclaim has been added to the -mm tree. Its filename is memory-cgroup-hierarchical-reclaim-v4-fix-for-hierarchical-reclaim.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: memcg: fix for hierarchical reclaim From: Daisuke Nishimura <d-nishimura@xxxxxxxxxxxxxxxxx> mem_cgroup_from_res_counter should handle both mem->res and mem->memsw. This bug leads to NULL pointer dereference BUG at mem_cgroup_calc_reclaim. Signed-off-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> Tested-by: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> Acked-by: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Dhaval Giani <dhaval@xxxxxxxxxxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Li Zefan <lizf@xxxxxxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Cc: Pavel Emelianov <xemul@xxxxxxxxxx> Cc: YAMAMOTO Takashi <yamamoto@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff -puN mm/memcontrol.c~memory-cgroup-hierarchical-reclaim-v4-fix-for-hierarchical-reclaim mm/memcontrol.c --- a/mm/memcontrol.c~memory-cgroup-hierarchical-reclaim-v4-fix-for-hierarchical-reclaim +++ a/mm/memcontrol.c @@ -468,11 +468,8 @@ unsigned long mem_cgroup_isolate_pages(u return nr_taken; } -static struct mem_cgroup * -mem_cgroup_from_res_counter(struct res_counter *counter) -{ - return container_of(counter, struct mem_cgroup, res); -} +#define mem_cgroup_from_res_counter(counter, member) \ + container_of(counter, struct mem_cgroup, member) /* * This routine finds the DFS walk successor. This routine should be @@ -664,18 +661,16 @@ static int __mem_cgroup_try_charge(struc /* mem+swap counter fails */ res_counter_uncharge(&mem->res, PAGE_SIZE); noswap = true; - } + mem_over_limit = mem_cgroup_from_res_counter(fail_res, + memsw); + } else + /* mem counter fails */ + mem_over_limit = mem_cgroup_from_res_counter(fail_res, + res); + if (!(gfp_mask & __GFP_WAIT)) goto nomem; - /* - * Is one of our ancestors over their limit? - */ - if (fail_res) - mem_over_limit = mem_cgroup_from_res_counter(fail_res); - else - mem_over_limit = mem; - ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, gfp_mask, noswap); _ Patches currently in -mm which might be from d-nishimura@xxxxxxxxxxxxxxxxx are memory-cgroup-hierarchical-reclaim-v4-fix-for-hierarchical-reclaim.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html