aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2012-07-31 19:42:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-31 21:42:41 -0400
commit9dd540e23111d8884773ab942a736f3aba4040d4 (patch)
tree84c7dcfa97c43d1f09ad88cdc836ff1b99da76e4 /mm/hugetlb.c
parent2bc64a2046975410505bb119bba32705892b9255 (diff)
hugetlb/cgroup: add the cgroup pointer to page lru
Add the hugetlb cgroup pointer to 3rd page lru.next. This limit the usage to hugetlb cgroup to only hugepages with 3 or more normal pages. I guess that is an acceptable limitation. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: David Rientjes <rientjes@google.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Hillf Danton <dhillf@gmail.com> Reviewed-by: Michal Hocko <mhocko@suse.cz> Cc: KOSAKI Motohiro <kosaki.motohiro@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/hugetlb.c')
-rw-r--r--mm/hugetlb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d5971597736b..efe29b53daff 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -28,6 +28,7 @@
28 28
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/hugetlb.h> 30#include <linux/hugetlb.h>
31#include <linux/hugetlb_cgroup.h>
31#include <linux/node.h> 32#include <linux/node.h>
32#include "internal.h" 33#include "internal.h"
33 34
@@ -591,6 +592,7 @@ static void update_and_free_page(struct hstate *h, struct page *page)
591 1 << PG_active | 1 << PG_reserved | 592 1 << PG_active | 1 << PG_reserved |
592 1 << PG_private | 1 << PG_writeback); 593 1 << PG_private | 1 << PG_writeback);
593 } 594 }
595 VM_BUG_ON(hugetlb_cgroup_from_page(page));
594 set_compound_page_dtor(page, NULL); 596 set_compound_page_dtor(page, NULL);
595 set_page_refcounted(page); 597 set_page_refcounted(page);
596 arch_release_hugepage(page); 598 arch_release_hugepage(page);
@@ -643,6 +645,7 @@ static void prep_new_huge_page(struct hstate *h, struct page *page, int nid)
643 INIT_LIST_HEAD(&page->lru); 645 INIT_LIST_HEAD(&page->lru);
644 set_compound_page_dtor(page, free_huge_page); 646 set_compound_page_dtor(page, free_huge_page);
645 spin_lock(&hugetlb_lock); 647 spin_lock(&hugetlb_lock);
648 set_hugetlb_cgroup(page, NULL);
646 h->nr_huge_pages++; 649 h->nr_huge_pages++;
647 h->nr_huge_pages_node[nid]++; 650 h->nr_huge_pages_node[nid]++;
648 spin_unlock(&hugetlb_lock); 651 spin_unlock(&hugetlb_lock);
@@ -892,6 +895,7 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid)
892 INIT_LIST_HEAD(&page->lru); 895 INIT_LIST_HEAD(&page->lru);
893 r_nid = page_to_nid(page); 896 r_nid = page_to_nid(page);
894 set_compound_page_dtor(page, free_huge_page); 897 set_compound_page_dtor(page, free_huge_page);
898 set_hugetlb_cgroup(page, NULL);
895 /* 899 /*
896 * We incremented the global counters already 900 * We incremented the global counters already
897 */ 901 */