[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1427791840-11247-2-git-send-email-n-horiguchi@ah.jp.nec.com>
Date: Tue, 31 Mar 2015 08:50:45 +0000
From: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: Hugh Dickins <hughd@...gle.com>, Michal Hocko <mhocko@...e.cz>,
Mel Gorman <mgorman@...e.de>,
Johannes Weiner <hannes@...xchg.org>,
David Rientjes <rientjes@...gle.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Naoya Horiguchi" <nao.horiguchi@...il.com>
Subject: [PATCH v3 1/3] mm: don't call __page_cache_release for hugetlb
__put_compound_page() calls __page_cache_release() to do some freeing works,
but it's obviously for thps, not for hugetlb. We didn't care it because PageLRU
is always cleared and page->mem_cgroup is always NULL for hugetlb.
But it's not correct and has potential risks, so let's make it conditional.
Signed-off-by: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
---
mm/swap.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git v4.0-rc6.orig/mm/swap.c v4.0-rc6/mm/swap.c
index cd3a5e64cea9..8e46823c3319 100644
--- v4.0-rc6.orig/mm/swap.c
+++ v4.0-rc6/mm/swap.c
@@ -31,6 +31,7 @@
#include <linux/memcontrol.h>
#include <linux/gfp.h>
#include <linux/uio.h>
+#include <linux/hugetlb.h>
#include "internal.h"
@@ -75,7 +76,14 @@ static void __put_compound_page(struct page *page)
{
compound_page_dtor *dtor;
- __page_cache_release(page);
+ /*
+ * __page_cache_release() is supposed to be called for thp, not for
+ * hugetlb. This is because hugetlb page does never have PageLRU set
+ * (it's never listed to any LRU lists) and no memcg routines should
+ * be called for hugetlb (it has a separate hugetlb_cgroup.)
+ */
+ if (!PageHuge(page))
+ __page_cache_release(page);
dtor = get_compound_page_dtor(page);
(*dtor)(page);
}
--
1.9.3
--
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