]> Pileus Git - ~andy/linux/blobdiff - mm/hugetlb_cgroup.c
mcast: add multicast proxy support (IPv4 and IPv6)
[~andy/linux] / mm / hugetlb_cgroup.c
index b5bde7a5c017b19a266b9b2f25408e0713a4e967..9cea7de22ffbf351b8cc77eb40563543e38d59b7 100644 (file)
@@ -333,7 +333,7 @@ static char *mem_fmt(char *buf, int size, unsigned long hsize)
        return buf;
 }
 
-int __init hugetlb_cgroup_file_init(int idx)
+static void __init __hugetlb_cgroup_file_init(int idx)
 {
        char buf[32];
        struct cftype *cft;
@@ -375,7 +375,22 @@ int __init hugetlb_cgroup_file_init(int idx)
 
        WARN_ON(cgroup_add_cftypes(&hugetlb_subsys, h->cgroup_files));
 
-       return 0;
+       return;
+}
+
+void __init hugetlb_cgroup_file_init(void)
+{
+       struct hstate *h;
+
+       for_each_hstate(h) {
+               /*
+                * Add cgroup control files only if the huge page consists
+                * of more than two normal pages. This is because we use
+                * page[2].lru.next for storing cgroup details.
+                */
+               if (huge_page_order(h) >= HUGETLB_CGROUP_MIN_ORDER)
+                       __hugetlb_cgroup_file_init(hstate_index(h));
+       }
 }
 
 /*