diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2008-07-24 00:27:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:17 -0400 |
commit | a3437870160cf2caaac6bdd76c7377a5a4145a8c (patch) | |
tree | 6d3c8ddd442e4cd96f1f8bdcf59fcaef72f4edc9 /include/linux | |
parent | a137e1cc6d6e7d315fef03962a2a5a113348b13b (diff) |
hugetlb: new sysfs interface
Provide new hugepages user APIs that are more suited to multiple hstates
in sysfs. There is a new directory, /sys/kernel/hugepages. Underneath
that directory there will be a directory per-supported hugepage size,
e.g.:
/sys/kernel/hugepages/hugepages-64kB
/sys/kernel/hugepages/hugepages-16384kB
/sys/kernel/hugepages/hugepages-16777216kB
corresponding to 64k, 16m and 16g respectively. Within each
hugepages-size directory there are a number of files, corresponding to the
tracked counters in the hstate, e.g.:
/sys/kernel/hugepages/hugepages-64/nr_hugepages
/sys/kernel/hugepages/hugepages-64/nr_overcommit_hugepages
/sys/kernel/hugepages/hugepages-64/free_hugepages
/sys/kernel/hugepages/hugepages-64/resv_hugepages
/sys/kernel/hugepages/hugepages-64/surplus_hugepages
Of these files, the first two are read-write and the latter three are
read-only. The size of the hugepage being manipulated is trivially
deducible from the enclosing directory and is always expressed in kB (to
match meminfo).
[dave@linux.vnet.ibm.com: fix build]
[nacc@us.ibm.com: hugetlb: hang off of /sys/kernel/mm rather than /sys/kernel]
[nacc@us.ibm.com: hugetlb: remove CONFIG_SYSFS dependency]
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hugetlb.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ba9263e631b9..58c0de32e7f0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -164,6 +164,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
164 | 164 | ||
165 | #ifdef CONFIG_HUGETLB_PAGE | 165 | #ifdef CONFIG_HUGETLB_PAGE |
166 | 166 | ||
167 | #define HSTATE_NAME_LEN 32 | ||
167 | /* Defines one hugetlb page size */ | 168 | /* Defines one hugetlb page size */ |
168 | struct hstate { | 169 | struct hstate { |
169 | int hugetlb_next_nid; | 170 | int hugetlb_next_nid; |
@@ -179,6 +180,7 @@ struct hstate { | |||
179 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; | 180 | unsigned int nr_huge_pages_node[MAX_NUMNODES]; |
180 | unsigned int free_huge_pages_node[MAX_NUMNODES]; | 181 | unsigned int free_huge_pages_node[MAX_NUMNODES]; |
181 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; | 182 | unsigned int surplus_huge_pages_node[MAX_NUMNODES]; |
183 | char name[HSTATE_NAME_LEN]; | ||
182 | }; | 184 | }; |
183 | 185 | ||
184 | void __init hugetlb_add_hstate(unsigned order); | 186 | void __init hugetlb_add_hstate(unsigned order); |