aboutsummaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2012-01-12 20:19:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-12 23:13:09 -0500
commit12d27107867fc7216e8faaff0b894b0f162dcf75 (patch)
tree8f35d39f7e5d0b0f0ba10a3475e9fa4a2581e509 /mm/huge_memory.c
parent0cee34fd72c582b4f8ad8ce00645b75fb4168199 (diff)
memcg: fix split_huge_page_refcounts()
This patch started off as a cleanup: __split_huge_page_refcounts() has to cope with two scenarios, when the hugepage being split is already on LRU, and when it is not; but why does it have to split that accounting across three different sites? Consolidate it in lru_add_page_tail(), handling evictable and unevictable alike, and use standard add_page_to_lru_list() when accounting is needed (when the head is not yet on LRU). But a recent regression in -next, I guess the removal of PageCgroupAcctLRU test from mem_cgroup_split_huge_fixup(), makes this now a necessary fix: under load, the MEM_CGROUP_ZSTAT count was wrapping to a huge number, messing up reclaim calculations and causing a freeze at rmdir of cgroup. Add a VM_BUG_ON to mem_cgroup_lru_del_list() when we're about to wrap that count - this has not been the only such incident. Document that lru_add_page_tail() is for Transparent HugePages by #ifdef around it. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 76cc3f7dd4f0..b3ffc21ce801 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1229,7 +1229,6 @@ static void __split_huge_page_refcount(struct page *page)
1229{ 1229{
1230 int i; 1230 int i;
1231 struct zone *zone = page_zone(page); 1231 struct zone *zone = page_zone(page);
1232 int zonestat;
1233 int tail_count = 0; 1232 int tail_count = 0;
1234 1233
1235 /* prevent PageLRU to go away from under us, and freeze lru stats */ 1234 /* prevent PageLRU to go away from under us, and freeze lru stats */
@@ -1317,15 +1316,6 @@ static void __split_huge_page_refcount(struct page *page)
1317 __dec_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); 1316 __dec_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES);
1318 __mod_zone_page_state(zone, NR_ANON_PAGES, HPAGE_PMD_NR); 1317 __mod_zone_page_state(zone, NR_ANON_PAGES, HPAGE_PMD_NR);
1319 1318
1320 /*
1321 * A hugepage counts for HPAGE_PMD_NR pages on the LRU statistics,
1322 * so adjust those appropriately if this page is on the LRU.
1323 */
1324 if (PageLRU(page)) {
1325 zonestat = NR_LRU_BASE + page_lru(page);
1326 __mod_zone_page_state(zone, zonestat, -(HPAGE_PMD_NR-1));
1327 }
1328
1329 ClearPageCompound(page); 1319 ClearPageCompound(page);
1330 compound_unlock(page); 1320 compound_unlock(page);
1331 spin_unlock_irq(&zone->lru_lock); 1321 spin_unlock_irq(&zone->lru_lock);