The patch titled memcg-handle-swap-cache fix has been added to the -mm tree. Its filename is memcg-handle-swap-cache-fix.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://www.zip.com.au/~akpm/linux/patches/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-handle-swap-cache fix From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Now (-mm queue), SwapCache is handled by memcg. But Handling migration of swap-cache was wrong. Fix to call uncharge() after ClearPageSwapCache() as __delete_from_swap_cache()(swap_state.c) does. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxx> Tested-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxx> Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Li Zefan <lizf@xxxxxxxxxxxxxx> Cc: Hugh Dickins <hugh@xxxxxxxxxxx> Cc: YAMAMOTO Takashi <yamamoto@xxxxxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff -puN mm/migrate.c~memcg-handle-swap-cache-fix mm/migrate.c --- a/mm/migrate.c~memcg-handle-swap-cache-fix +++ a/mm/migrate.c @@ -358,10 +358,8 @@ static int migrate_page_move_mapping(str __inc_zone_page_state(newpage, NR_FILE_PAGES); write_unlock_irq(&mapping->tree_lock); - if (!PageSwapCache(newpage)) { + if (!PageSwapCache(newpage)) mem_cgroup_uncharge_cache_page(page); - } else - mem_cgroup_uncharge_page(page); return 0; } @@ -399,7 +397,15 @@ static void migrate_page_copy(struct pag } #ifdef CONFIG_SWAP - ClearPageSwapCache(page); + if (PageSwapCache(page)) { + ClearPageSwapCache(page); + /* + * SwapCache is removed implicitly. Uncharge against swapcache + * should be called after ClearPageSwapCache() because + * mem_cgroup_uncharge_page checks the flag. + */ + mem_cgroup_uncharge_page(page); + } #endif ClearPageActive(page); ClearPagePrivate(page); _ Patches currently in -mm which might be from kamezawa.hiroyu@xxxxxxxxxxxxxx are page-flags-record-page-flag-overlays-explicitly.patch page-flags-record-page-flag-overlays-explicitly-xen.patch mark-res_counter_charge_locked-with-__must_check.patch memcg-make-global-var-read_mostly.patch memcg-avoid-unnecessary-initialization.patch memcg-better-migration-handling.patch memcg-remove-refcnt-from-page_cgroup.patch memcg-remove-refcnt-from-page_cgroup-fix.patch memcg-handle-swap-cache.patch memcg-handle-swap-cache-fix.patch memcg-helper-function-for-relcaim-from-shmem.patch memcg-add-hints-for-branch.patch memcg-remove-a-redundant-check.patch memcg-clean-up-checking-of-the-disabled-flag.patch memrlimit-add-memrlimit-controller-documentation.patch memrlimit-setup-the-memrlimit-controller.patch memrlimit-cgroup-mm-owner-callback-changes-to-add-task-info.patch memrlimit-add-memrlimit-controller-accounting-and-control.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