From 6039115575c893f5308fc4383f1ba49e01eea3f3 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Tue, 31 Jul 2012 16:45:50 -0700 Subject: [PATCH] --- yaml --- r: 320855 b: refs/heads/master c: bdf4f4d2161a795b9323855a81a047bd68f16202 h: refs/heads/master i: 320853: fb60dbcbdb168388cfdf623cc81ad1288ee47e93 320851: d0ef03537365764c17a8425dc27a9eae083604eb 320847: 6b7c3da0a62c39389f2ecd239486c95c01566883 v: v3 --- [refs] | 2 +- trunk/mm/memcontrol.c | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index b212961e1798..0dc8acff6e61 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 90deb78839faedd194b65d419dbd9cba981e1922 +refs/heads/master: bdf4f4d2161a795b9323855a81a047bd68f16202 diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 1a2020d72ca0..b06833f2b89e 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -2818,14 +2818,6 @@ static int __mem_cgroup_try_charge_swapin(struct mm_struct *mm, return 0; if (!do_swap_account) goto charge_cur_mm; - /* - * A racing thread's fault, or swapoff, may have already updated - * the pte, and even removed page from swap cache: in those cases - * do_swap_page()'s pte_same() test will fail; but there's also a - * KSM case which does need to charge the page. - */ - if (!PageSwapCache(page)) - goto charge_cur_mm; memcg = try_get_mem_cgroup_from_page(page); if (!memcg) goto charge_cur_mm; @@ -2848,6 +2840,20 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm, struct page *page, *memcgp = NULL; if (mem_cgroup_disabled()) return 0; + /* + * A racing thread's fault, or swapoff, may have already + * updated the pte, and even removed page from swap cache: in + * those cases unuse_pte()'s pte_same() test will fail; but + * there's also a KSM case which does need to charge the page. + */ + if (!PageSwapCache(page)) { + int ret; + + ret = __mem_cgroup_try_charge(mm, gfp_mask, 1, memcgp, true); + if (ret == -EINTR) + ret = 0; + return ret; + } return __mem_cgroup_try_charge_swapin(mm, page, gfp_mask, memcgp); }