The patch titled memcg: fix shmem_unuse_inode charging has been removed from the -mm tree. Its filename was memcg-remove-refcnt-from-page_cgroup-memcg-fix-shmem_unuse_inode-charging.patch This patch was dropped because it was folded into memcg-remove-refcnt-from-page_cgroup.patch The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: memcg: fix shmem_unuse_inode charging From: Hugh Dickins <hugh@xxxxxxxxxxx> The mem_cgroup_cache_charge in shmem_unuse_inode has been moved after the radix_tree_preload, so generating a BUG: sleeping function called from invalid context. Move it back, uncharging where necessary. Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Acked-by: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Li Zefan <lizf@xxxxxxxxxxxxxx> Cc: YAMAMOTO Takashi <yamamoto@xxxxxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff -puN mm/shmem.c~memcg-remove-refcnt-from-page_cgroup-memcg-fix-shmem_unuse_inode-charging mm/shmem.c --- a/mm/shmem.c~memcg-remove-refcnt-from-page_cgroup-memcg-fix-shmem_unuse_inode-charging +++ a/mm/shmem.c @@ -922,27 +922,24 @@ found: error = 1; if (!inode) goto out; - error = radix_tree_preload(GFP_KERNEL); - if (error) - goto out; - /* - * Because we use GFP_NOWAIT in add_to_page_cache(), we can see -ENOMEM - * failure because of memory pressure in memory resource controller. - * Then, precharge page while we can wait, uncharge at failure will be - * automatically done in add_to_page_cache() - */ + /* Precharge page using GFP_KERNEL while we can wait */ error = mem_cgroup_cache_charge(page, current->mm, GFP_KERNEL); if (error) - goto preload_out; - + goto out; + error = radix_tree_preload(GFP_KERNEL); + if (error) { + mem_cgroup_uncharge_cache_page(page); + goto out; + } error = 1; spin_lock(&info->lock); ptr = shmem_swp_entry(info, idx, NULL); - if (ptr && ptr->val == entry.val) - error = add_to_page_cache(page, inode->i_mapping, idx, - GFP_NOWAIT); - else /* we don't have to account this page. */ + if (ptr && ptr->val == entry.val) { + error = add_to_page_cache(page, inode->i_mapping, + idx, GFP_NOWAIT); + /* does mem_cgroup_uncharge_cache_page on error */ + } else /* we must compensate for our precharge above */ mem_cgroup_uncharge_cache_page(page); if (error == -EEXIST) { @@ -969,7 +966,6 @@ found: if (ptr) shmem_swp_unmap(ptr); spin_unlock(&info->lock); -preload_out: radix_tree_preload_end(); out: unlock_page(page); _ Patches currently in -mm which might be from hugh@xxxxxxxxxxx are origin.patch exec-remove-some-includes.patch memcg-better-migration-handling.patch memcg-remove-refcnt-from-page_cgroup.patch memcg-remove-refcnt-from-page_cgroup-memcg-fix-shmem_unuse_inode-charging.patch memcg-helper-function-for-relcaim-from-shmem.patch memcg-helper-function-for-relcaim-from-shmem-memcg-shmem_getpage-release-page-sooner.patch memcg-helper-function-for-relcaim-from-shmem-memcg-mem_cgroup_shrink_usage-css_put.patch memcg-add-hints-for-branch.patch memcg-remove-a-redundant-check.patch memcg-clean-up-checking-of-the-disabled-flag-memcg-further-checking-of-disabled-flag.patch memrlimit-cgroup-mm-owner-callback-changes-to-add-task-info-memrlimit-fix-mmap_sem-deadlock.patch memrlimit-cgroup-mm-owner-callback-changes-to-add-task-info-memrlimit-fix-sleep-inside-sleeplock-in-mm_update_next_owner.patch memrlimit-add-memrlimit-controller-accounting-and-control-memrlimit-improve-fork-and-error-handling.patch memrlimit-improve-error-handling.patch memrlimit-improve-error-handling-update.patch memrlimit-handle-attach_task-failure-add-can_attach-callback.patch memrlimit-handle-attach_task-failure-add-can_attach-callback-update.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