summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 15:47:16 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 17:32:47 -0800
commit37c2ac7872a9387542616f658d20ac25f5bdb32e (patch)
treed115915db4a61e261012bf0f9c4cf14630243d71 /mm/memcontrol.c
parent91600e9e592e48736e630851c83da2ad6bf0e91f (diff)
thp: compound_trans_order
Read compound_trans_order safe. Noop for CONFIG_TRANSPARENT_HUGEPAGE=n. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f4ea3410fb4..741206ffdac 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1027,10 +1027,6 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
{
struct page_cgroup *pc;
struct mem_cgroup_per_zone *mz;
- int page_size = PAGE_SIZE;
-
- if (PageTransHuge(page))
- page_size <<= compound_order(page);
if (mem_cgroup_disabled())
return NULL;
@@ -2286,8 +2282,10 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
int ret;
int page_size = PAGE_SIZE;
- if (PageTransHuge(page))
+ if (PageTransHuge(page)) {
page_size <<= compound_order(page);
+ VM_BUG_ON(!PageTransHuge(page));
+ }
pc = lookup_page_cgroup(page);
/* can happen at boot */
@@ -2558,8 +2556,10 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
if (PageSwapCache(page))
return NULL;
- if (PageTransHuge(page))
+ if (PageTransHuge(page)) {
page_size <<= compound_order(page);
+ VM_BUG_ON(!PageTransHuge(page));
+ }
count = page_size >> PAGE_SHIFT;
/*