From: Zou Nan hai <nanhai.zou@intel.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linux-IA64 <linux-ia64@vger.kernel.org>,
Tony <tony.luck@intel.com>, Kenneth W <kenneth.w.chen@intel.com>
Subject: Re: [PATCH 5/8] IA64 various hugepage size - mount more hugetlb fs
Date: Fri, 14 Apr 2006 00:49:07 +0000 [thread overview]
Message-ID: <1144975746.5817.94.camel@linux-znh> (raw)
In-Reply-To: <1144975523.5817.84.camel@linux-znh>
Mount more hugetlbfs for SHM to support various hugepage size
in SHM.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
diff -Nraup a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
--- a/fs/hugetlbfs/inode.c 2006-04-12 10:15:03.000000000 +0800
+++ b/fs/hugetlbfs/inode.c 2006-04-12 10:17:23.000000000 +0800
@@ -759,7 +759,7 @@ static struct file_system_type hugetlbfs
.kill_sb = kill_litter_super,
};
-static struct vfsmount *hugetlbfs_vfsmount;
+static struct vfsmount *hugetlbfs_vfsmount[MAX_ORDER];
static int can_do_hugetlb_shm(void)
{
@@ -784,7 +784,7 @@ struct file *hugetlb_zero_setup(size_t s
if (!user_shm_lock(size, current->user))
return ERR_PTR(-ENOMEM);
- root = hugetlbfs_vfsmount->mnt_root;
+ root = hugetlbfs_vfsmount[order]->mnt_root;
snprintf(buf, 16, "%u", atomic_inc_return(&counter));
quick_string.name = buf;
quick_string.len = strlen(quick_string.name);
@@ -812,7 +812,7 @@ struct file *hugetlb_zero_setup(size_t s
d_instantiate(dentry, inode);
inode->i_size = size;
inode->i_nlink = 0;
- file->f_vfsmnt = mntget(hugetlbfs_vfsmount);
+ file->f_vfsmnt = mntget(hugetlbfs_vfsmount[order]);
file->f_dentry = dentry;
file->f_mapping = inode->i_mapping;
file->f_op = &hugetlbfs_file_operations;
@@ -834,27 +834,49 @@ static int __init init_hugetlbfs_fs(void
{
int error;
struct vfsmount *vfsmount;
-
hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
- sizeof(struct hugetlbfs_inode_info),
- 0, 0, init_once, NULL);
+ sizeof(struct hugetlbfs_inode_info),
+ 0, 0, init_once, NULL);
if (hugetlbfs_inode_cachep = NULL)
return -ENOMEM;
error = register_filesystem(&hugetlbfs_fs_type);
if (error)
goto out;
-
- vfsmount = kern_mount(&hugetlbfs_fs_type);
-
- if (!IS_ERR(vfsmount)) {
- hugetlbfs_vfsmount = vfsmount;
- return 0;
+#ifdef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+ {
+ int order;
+ char fsname[64], data[64];
+ for (order = 0; order < MAX_ORDER; order++) {
+ if (is_valid_hpage_size(1UL<<(PAGE_SHIFT+order))) {
+ sprintf(fsname, "%s%d", hugetlbfs_fs_type.name, order);
+ sprintf(data, "page_size=%ld", (1UL<<(PAGE_SHIFT+order)));
+ vfsmount = do_kern_mount(hugetlbfs_fs_type.name, 0,
+ fsname, data);
+
+ if (!IS_ERR(vfsmount))
+ hugetlbfs_vfsmount[order] = vfsmount;
+ else {
+ error = PTR_ERR(vfsmount);
+ goto out;
+ }
+ }
+ }
}
+#else
+ vfsmount = kern_mount(&hugetlbfs_fs_type);
- error = PTR_ERR(vfsmount);
+ if (!IS_ERR(vfsmount)) {
+ hugetlbfs_vfsmount[HUGETLB_INIT_PAGE_ORDER] = vfsmount;
+ return 0;
+ }
+
+ error = PTR_ERR(vfsmount);
+ goto out;
+#endif
+ return 0;
- out:
+out:
if (error)
kmem_cache_destroy(hugetlbfs_inode_cachep);
return error;
WARNING: multiple messages have this Message-ID (diff)
From: Zou Nan hai <nanhai.zou@intel.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linux-IA64 <linux-ia64@vger.kernel.org>,
Tony <tony.luck@intel.com>, Kenneth W <kenneth.w.chen@intel.com>
Subject: Re: [PATCH 5/8] IA64 various hugepage size - mount more hugetlb fs for SHM
Date: 14 Apr 2006 08:49:07 +0800 [thread overview]
Message-ID: <1144975746.5817.94.camel@linux-znh> (raw)
In-Reply-To: <1144975523.5817.84.camel@linux-znh>
Mount more hugetlbfs for SHM to support various hugepage size
in SHM.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
diff -Nraup a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
--- a/fs/hugetlbfs/inode.c 2006-04-12 10:15:03.000000000 +0800
+++ b/fs/hugetlbfs/inode.c 2006-04-12 10:17:23.000000000 +0800
@@ -759,7 +759,7 @@ static struct file_system_type hugetlbfs
.kill_sb = kill_litter_super,
};
-static struct vfsmount *hugetlbfs_vfsmount;
+static struct vfsmount *hugetlbfs_vfsmount[MAX_ORDER];
static int can_do_hugetlb_shm(void)
{
@@ -784,7 +784,7 @@ struct file *hugetlb_zero_setup(size_t s
if (!user_shm_lock(size, current->user))
return ERR_PTR(-ENOMEM);
- root = hugetlbfs_vfsmount->mnt_root;
+ root = hugetlbfs_vfsmount[order]->mnt_root;
snprintf(buf, 16, "%u", atomic_inc_return(&counter));
quick_string.name = buf;
quick_string.len = strlen(quick_string.name);
@@ -812,7 +812,7 @@ struct file *hugetlb_zero_setup(size_t s
d_instantiate(dentry, inode);
inode->i_size = size;
inode->i_nlink = 0;
- file->f_vfsmnt = mntget(hugetlbfs_vfsmount);
+ file->f_vfsmnt = mntget(hugetlbfs_vfsmount[order]);
file->f_dentry = dentry;
file->f_mapping = inode->i_mapping;
file->f_op = &hugetlbfs_file_operations;
@@ -834,27 +834,49 @@ static int __init init_hugetlbfs_fs(void
{
int error;
struct vfsmount *vfsmount;
-
hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
- sizeof(struct hugetlbfs_inode_info),
- 0, 0, init_once, NULL);
+ sizeof(struct hugetlbfs_inode_info),
+ 0, 0, init_once, NULL);
if (hugetlbfs_inode_cachep == NULL)
return -ENOMEM;
error = register_filesystem(&hugetlbfs_fs_type);
if (error)
goto out;
-
- vfsmount = kern_mount(&hugetlbfs_fs_type);
-
- if (!IS_ERR(vfsmount)) {
- hugetlbfs_vfsmount = vfsmount;
- return 0;
+#ifdef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+ {
+ int order;
+ char fsname[64], data[64];
+ for (order = 0; order < MAX_ORDER; order++) {
+ if (is_valid_hpage_size(1UL<<(PAGE_SHIFT+order))) {
+ sprintf(fsname, "%s%d", hugetlbfs_fs_type.name, order);
+ sprintf(data, "page_size=%ld", (1UL<<(PAGE_SHIFT+order)));
+ vfsmount = do_kern_mount(hugetlbfs_fs_type.name, 0,
+ fsname, data);
+
+ if (!IS_ERR(vfsmount))
+ hugetlbfs_vfsmount[order] = vfsmount;
+ else {
+ error = PTR_ERR(vfsmount);
+ goto out;
+ }
+ }
+ }
}
+#else
+ vfsmount = kern_mount(&hugetlbfs_fs_type);
- error = PTR_ERR(vfsmount);
+ if (!IS_ERR(vfsmount)) {
+ hugetlbfs_vfsmount[HUGETLB_INIT_PAGE_ORDER] = vfsmount;
+ return 0;
+ }
+
+ error = PTR_ERR(vfsmount);
+ goto out;
+#endif
+ return 0;
- out:
+out:
if (error)
kmem_cache_destroy(hugetlbfs_inode_cachep);
return error;
next prev parent reply other threads:[~2006-04-14 0:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-14 0:26 [PATCH 0/8] IA64 various hugepage size - Overview Zou Nan hai
2006-04-14 0:26 ` Zou Nan hai
2006-04-14 0:31 ` [PATCH 1/8] IA64 various hugepage size - Add a variable to mm Zou Nan hai
2006-04-14 0:31 ` [PATCH 1/8] IA64 various hugepage size - Add a variable to mm structure Zou Nan hai
2006-04-14 0:34 ` [PATCH 2/8] IA64 various hugepage size - Add the Zou Nan hai
2006-04-14 0:34 ` [PATCH 2/8] IA64 various hugepage size - Add the is_valid_hpage_size function Zou Nan hai
2006-04-14 0:41 ` [PATCH 3/8] IA64 various hugepage size - Add a mount option to Zou Nan hai
2006-04-14 0:41 ` [PATCH 3/8] IA64 various hugepage size - Add a mount option to hugetlbfs Zou Nan hai
2006-04-14 0:45 ` [PATCH 4/8] IA64 various hugepage size - modify HPAGE related Zou Nan hai
2006-04-14 0:45 ` [PATCH 4/8] IA64 various hugepage size - modify HPAGE related macros Zou Nan hai
2006-04-14 0:49 ` Zou Nan hai [this message]
2006-04-14 0:49 ` [PATCH 5/8] IA64 various hugepage size - mount more hugetlb fs for SHM Zou Nan hai
2006-04-14 0:52 ` [PATCH 6/8] IA64 various hugepage size - introduce prctl Zou Nan hai
2006-04-14 0:52 ` [PATCH 6/8] IA64 various hugepage size - introduce prctl options to set/get hugepage size Zou Nan hai
2006-04-14 0:57 ` [PATCH 7/8] IA64 various hugepage size - Add proc control to Zou Nan hai
2006-04-14 0:57 ` [PATCH 7/8] IA64 various hugepage size - Add proc control to reserve and free Zou Nan hai
2006-04-14 1:00 ` [PATCH 8/8] IA64 various hugepage size - Modify kernel document Zou Nan hai
2006-04-14 1:00 ` Zou Nan hai
2006-04-14 3:12 ` Randy.Dunlap
2006-04-14 3:12 ` Randy.Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1144975746.5817.94.camel@linux-znh \
--to=nanhai.zou@intel.com \
--cc=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.