The patch titled memcg: move page-freeing code out of lock has been added to the -mm tree. Its filename is memcg-move-page-freeing-code-out-of-lock.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: move page-freeing code out of lock From: Namhyung Kim <namhyung@xxxxxxxxx> Move page-freeing code out of swap_cgroup_mutex in the hope that it could reduce few of theoretical contentions between swapons and/or swapoffs. This is just a cleanup, no functional changes. Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> Cc: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_cgroup.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff -puN mm/page_cgroup.c~memcg-move-page-freeing-code-out-of-lock mm/page_cgroup.c --- a/mm/page_cgroup.c~memcg-move-page-freeing-code-out-of-lock +++ a/mm/page_cgroup.c @@ -492,8 +492,8 @@ int swap_cgroup_swapon(int type, unsigne /* memory shortage */ ctrl->map = NULL; ctrl->length = 0; - vfree(array); mutex_unlock(&swap_cgroup_mutex); + vfree(array); goto nomem; } mutex_unlock(&swap_cgroup_mutex); @@ -508,7 +508,8 @@ nomem: void swap_cgroup_swapoff(int type) { - int i; + struct page **map; + unsigned long i, length; struct swap_cgroup_ctrl *ctrl; if (!do_swap_account) @@ -516,17 +517,20 @@ void swap_cgroup_swapoff(int type) mutex_lock(&swap_cgroup_mutex); ctrl = &swap_cgroup_ctrl[type]; - if (ctrl->map) { - for (i = 0; i < ctrl->length; i++) { - struct page *page = ctrl->map[i]; + map = ctrl->map; + length = ctrl->length; + ctrl->map = NULL; + ctrl->length = 0; + mutex_unlock(&swap_cgroup_mutex); + + if (map) { + for (i = 0; i < length; i++) { + struct page *page = map[i]; if (page) __free_page(page); } - vfree(ctrl->map); - ctrl->map = NULL; - ctrl->length = 0; + vfree(map); } - mutex_unlock(&swap_cgroup_mutex); } #endif _ Patches currently in -mm which might be from namhyung@xxxxxxxxx are mm-nommu-sort-mm-mmap-list-properly.patch mm-nommu-sort-mm-mmap-list-properly-fix.patch mm-nommu-dont-scan-the-vma-list-when-deleting.patch mm-nommu-find-vma-using-the-sorted-vma-list.patch mm-nommu-check-the-vma-list-when-unmapping-file-mapped-vma.patch mm-nommu-fix-a-potential-memory-leak-in-do_mmap_private.patch mm-nommu-fix-a-compile-warning-in-do_mmap_pgoff.patch memcg-mark-init_section_page_cgroup-properly.patch memcg-fix-off-by-one-when-calculating-swap-cgroup-map-length.patch memcg-move-page-freeing-code-out-of-lock.patch maintainers-add-mm-page_cgroupc-into-memcg-subsystem.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