thp: fix anon memory statistics with transparent hugepages
Count each transparent hugepage as HPAGE_PMD_NR pages in the LRU statistics, so the Active(anon) and Inactive(anon) statistics in /proc/meminfo are correct. Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
97562cd243
commit
2c888cfbc1
@@ -1,6 +1,8 @@
|
||||
#ifndef LINUX_MM_INLINE_H
|
||||
#define LINUX_MM_INLINE_H
|
||||
|
||||
#include <linux/huge_mm.h>
|
||||
|
||||
/**
|
||||
* page_is_file_cache - should the page be on a file LRU or anon LRU?
|
||||
* @page: the page to test
|
||||
@@ -24,7 +26,7 @@ __add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l,
|
||||
struct list_head *head)
|
||||
{
|
||||
list_add(&page->lru, head);
|
||||
__inc_zone_state(zone, NR_LRU_BASE + l);
|
||||
__mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page));
|
||||
mem_cgroup_add_lru_list(page, l);
|
||||
}
|
||||
|
||||
@@ -38,7 +40,7 @@ static inline void
|
||||
del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
|
||||
{
|
||||
list_del(&page->lru);
|
||||
__dec_zone_state(zone, NR_LRU_BASE + l);
|
||||
__mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page));
|
||||
mem_cgroup_del_lru_list(page, l);
|
||||
}
|
||||
|
||||
@@ -73,7 +75,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
|
||||
l += LRU_ACTIVE;
|
||||
}
|
||||
}
|
||||
__dec_zone_state(zone, NR_LRU_BASE + l);
|
||||
__mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page));
|
||||
mem_cgroup_del_lru_list(page, l);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user