[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1341449103-1986-4-git-send-email-hannes@cmpxchg.org>
Date: Thu, 5 Jul 2012 02:44:55 +0200
From: Johannes Weiner <hannes@...xchg.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Michal Hocko <mhocko@...e.cz>, Hugh Dickins <hughd@...gle.com>,
David Rientjes <rientjes@...gle.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [patch 03/11] mm: shmem: do not try to uncharge known swapcache pages
Once charged, swapcache pages can only be uncharged after they are
removed from swapcache again.
Do not try to uncharge pages that are known to be in the swapcache, to
allow future patches to remove checks for that in the uncharge code.
Signed-off-by: Johannes Weiner <hannes@...xchg.org>
---
mm/shmem.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index ee1c5a2..d12b705 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -302,8 +302,6 @@ static int shmem_add_to_page_cache(struct page *page,
if (!expected)
radix_tree_preload_end();
}
- if (error)
- mem_cgroup_uncharge_cache_page(page);
return error;
}
@@ -1184,11 +1182,14 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
__set_page_locked(page);
error = mem_cgroup_cache_charge(page, current->mm,
gfp & GFP_RECLAIM_MASK);
- if (!error)
- error = shmem_add_to_page_cache(page, mapping, index,
- gfp, NULL);
if (error)
goto decused;
+ error = shmem_add_to_page_cache(page, mapping, index,
+ gfp, NULL);
+ if (error) {
+ mem_cgroup_uncharge_cache_page(page);
+ goto decused;
+ }
lru_cache_add_anon(page);
spin_lock(&info->lock);
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists