Hi Andi, On Sat, Oct 13, 2012 at 11:38 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote: > v2: Port to new tree. Fix unmount. > v3: Ported to latest tree. > v4: Ported to latest tree. Minor changes for review feedback. Updated > description. > v5: Remove unnecessary prototypes to fix merge error (Hillf Dalton) s/Dalton/Danton/ > struct file *hugetlb_file_setup(const char *name, unsigned long addr, > size_t size, vm_flags_t acctflag, > - struct user_struct **user, int creat_flags) > + struct user_struct **user, > + int creat_flags, int page_size_log) > { > int error = -ENOMEM; > struct file *file; > @@ -944,9 +957,14 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, > struct qstr quick_string; > struct hstate *hstate; > unsigned long num_pages; > + int hstate_idx; > + > + hstate_idx = get_hstate_idx(page_size_log); > + if (hstate_idx < 0) > + return ERR_PTR(-ENODEV); > > *user = NULL; > - if (!hugetlbfs_vfsmount) > + if (!hugetlbfs_vfsmount[hstate_idx]) Maybe if (IS_ERR(hugetlbfs_vfsmount[hstate_idx])) since ... > static int __init init_hugetlbfs_fs(void) > { > + struct hstate *h; > int error; > - struct vfsmount *vfsmount; > + int i; > > error = bdi_init(&hugetlbfs_backing_dev_info); > if (error) > @@ -1029,14 +1048,26 @@ static int __init init_hugetlbfs_fs(void) > if (error) > goto out; > > - vfsmount = kern_mount(&hugetlbfs_fs_type); > + i = 0; > + for_each_hstate (h) { > + char buf[50]; > + unsigned ps_kb = 1U << (h->order + PAGE_SHIFT - 10); > > - if (!IS_ERR(vfsmount)) { > - hugetlbfs_vfsmount = vfsmount; > - return 0; > - } > + snprintf(buf, sizeof buf, "pagesize=%uK", ps_kb); > + hugetlbfs_vfsmount[i] = kern_mount_data(&hugetlbfs_fs_type, > + buf); > > - error = PTR_ERR(vfsmount); > + if (IS_ERR(hugetlbfs_vfsmount[i])) { > + pr_err( > + "hugetlb: Cannot mount internal hugetlbfs for page size %uK", > + ps_kb); > + error = PTR_ERR(hugetlbfs_vfsmount[i]); ... hugetlbfs_vfsmount[i] is not reset. > + } > + i++; > + } > + /* Non default hstates are optional */ > + if (hugetlbfs_vfsmount[default_hstate_idx]) ditto. BTW, resetting looks simpler? > + return 0; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>