aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2008-07-24 00:27:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:17 -0400
commita137e1cc6d6e7d315fef03962a2a5a113348b13b (patch)
treeb47e195c392abaa3640cc2f9187d99d58cee664a /include/linux/hugetlb.h
parente5ff215941d59f8ae6bf58f6428dc5c26745a612 (diff)
hugetlbfs: per mount huge page sizes
Add the ability to configure the hugetlb hstate used on a per mount basis. - Add a new pagesize= option to the hugetlbfs mount that allows setting the page size - This option causes the mount code to find the hstate corresponding to the specified size, and sets up a pointer to the hstate in the mount's superblock. - Change the hstate accessors to use this information rather than the global_hstate they were using (requires a slight change in mm/memory.c so we don't NULL deref in the error-unmap path -- see comments). [np: take hstate out of hugetlbfs inode and vma->vm_private_data] Acked-by: Adam Litke <agl@us.ibm.com> Acked-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r--include/linux/hugetlb.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index b75bdb4deba3..ba9263e631b9 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -100,6 +100,7 @@ struct hugetlbfs_config {
100 umode_t mode; 100 umode_t mode;
101 long nr_blocks; 101 long nr_blocks;
102 long nr_inodes; 102 long nr_inodes;
103 struct hstate *hstate;
103}; 104};
104 105
105struct hugetlbfs_sb_info { 106struct hugetlbfs_sb_info {
@@ -108,6 +109,7 @@ struct hugetlbfs_sb_info {
108 long max_inodes; /* inodes allowed */ 109 long max_inodes; /* inodes allowed */
109 long free_inodes; /* inodes free */ 110 long free_inodes; /* inodes free */
110 spinlock_t stat_lock; 111 spinlock_t stat_lock;
112 struct hstate *hstate;
111}; 113};
112 114
113 115
@@ -191,19 +193,21 @@ extern unsigned int default_hstate_idx;
191 193
192#define default_hstate (hstates[default_hstate_idx]) 194#define default_hstate (hstates[default_hstate_idx])
193 195
194static inline struct hstate *hstate_vma(struct vm_area_struct *vma) 196static inline struct hstate *hstate_inode(struct inode *i)
195{ 197{
196 return &default_hstate; 198 struct hugetlbfs_sb_info *hsb;
199 hsb = HUGETLBFS_SB(i->i_sb);
200 return hsb->hstate;
197} 201}
198 202
199static inline struct hstate *hstate_file(struct file *f) 203static inline struct hstate *hstate_file(struct file *f)
200{ 204{
201 return &default_hstate; 205 return hstate_inode(f->f_dentry->d_inode);
202} 206}
203 207
204static inline struct hstate *hstate_inode(struct inode *i) 208static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
205{ 209{
206 return &default_hstate; 210 return hstate_file(vma->vm_file);
207} 211}
208 212
209static inline unsigned long huge_page_size(struct hstate *h) 213static inline unsigned long huge_page_size(struct hstate *h)