diff options
author | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> | 2015-04-15 19:14:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:19 -0400 |
commit | 822fc61367f062d36c5b5a4d517e9bd2b65a741f (patch) | |
tree | 01e85731a4d8b4e4f9252d9e6e2e6a8e597d05ff /mm | |
parent | 9fcd145717e6496d0c376acb1a5cc551a716c305 (diff) |
mm: don't call __page_cache_release for hugetlb
__put_compound_page() calls __page_cache_release() to do some freeing
work, but it's obviously for thps, not for hugetlb. We don't care 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@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/swap.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/memcontrol.h> | 31 | #include <linux/memcontrol.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/uio.h> | 33 | #include <linux/uio.h> |
34 | #include <linux/hugetlb.h> | ||
34 | 35 | ||
35 | #include "internal.h" | 36 | #include "internal.h" |
36 | 37 | ||
@@ -75,7 +76,14 @@ static void __put_compound_page(struct page *page) | |||
75 | { | 76 | { |
76 | compound_page_dtor *dtor; | 77 | compound_page_dtor *dtor; |
77 | 78 | ||
78 | __page_cache_release(page); | 79 | /* |
80 | * __page_cache_release() is supposed to be called for thp, not for | ||
81 | * hugetlb. This is because hugetlb page does never have PageLRU set | ||
82 | * (it's never listed to any LRU lists) and no memcg routines should | ||
83 | * be called for hugetlb (it has a separate hugetlb_cgroup.) | ||
84 | */ | ||
85 | if (!PageHuge(page)) | ||
86 | __page_cache_release(page); | ||
79 | dtor = get_compound_page_dtor(page); | 87 | dtor = get_compound_page_dtor(page); |
80 | (*dtor)(page); | 88 | (*dtor)(page); |
81 | } | 89 | } |