public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 3/8] IA64 various hugepage size - Add a mount option to hugetlbfs
Date: 14 Apr 2006 08:41:32 +0800	[thread overview]
Message-ID: <1144975292.5817.74.camel@linux-znh> (raw)
In-Reply-To: <1144974881.5817.59.camel@linux-znh>

Add a mount option page_size= to hugetlbfs.
The s_blocksize_bits in hugetlb super block will indicate the huge page size which attached 
to this fs.

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-11 08:51:59.000000000 +0800
+++ b/fs/hugetlbfs/inode.c	2006-04-11 10:55:49.000000000 +0800
@@ -63,6 +63,14 @@ static int hugetlbfs_file_mmap(struct fi
 	loff_t len, vma_len;
 	int ret;
 
+#ifdef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+        struct super_block *sb = inode->i_sb;
+        unsigned long hpage_shift = sb->s_blocksize_bits;
+
+        if (hpage_shift != vma->vm_mm->hugepage_shift)
+                return -EINVAL;
+#endif
+
 	if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
 		return -EINVAL;
 
@@ -632,7 +640,17 @@ hugetlbfs_parse_options(char *options, s
 			size &= HPAGE_MASK;
 			pconfig->nr_blocks = (size >> HPAGE_SHIFT);
 			value = rest;
-		} else if (!strcmp(opt,"nr_inodes")) {
+		}
+#ifdef ARCH_HAS_VARIABLE_HUGEPAGE_SIZE
+                else if (!strcmp(opt, "page_size")) {
+                        unsigned long long size = memparse(value, &rest);
+                        if (!is_valid_hpage_size(size))
+                                return -EINVAL;
+                        pconfig->page_shift = __ffs(size);
+                        value = rest;
+                }
+#endif
+		else if (!strcmp(opt,"nr_inodes")) {
 			pconfig->nr_inodes = memparse(value, &rest);
 			value = rest;
 		} else
@@ -658,6 +676,7 @@ hugetlbfs_fill_super(struct super_block 
 	config.uid = current->fsuid;
 	config.gid = current->fsgid;
 	config.mode = 0755;
+	config.page_shift = HPAGE_SHIFT;
 	ret = hugetlbfs_parse_options(data, &config);
 
 	if (ret)
@@ -673,8 +692,8 @@ hugetlbfs_fill_super(struct super_block 
 	sbinfo->max_inodes = config.nr_inodes;
 	sbinfo->free_inodes = config.nr_inodes;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
-	sb->s_blocksize = HPAGE_SIZE;
-	sb->s_blocksize_bits = HPAGE_SHIFT;
+	sb->s_blocksize = 1UL << config.page_shift;
+	sb->s_blocksize_bits = config.page_shift;
 	sb->s_magic = HUGETLBFS_MAGIC;
 	sb->s_op = &hugetlbfs_ops;
 	sb->s_time_gran = 1;
diff -Nraup a/include/linux/hugetlb.h b/include/linux/hugetlb.h
--- a/include/linux/hugetlb.h	2006-04-11 08:52:00.000000000 +0800
+++ b/include/linux/hugetlb.h	2006-04-11 10:51:41.000000000 +0800
@@ -124,6 +124,7 @@ struct hugetlbfs_config {
 	uid_t   uid;
 	gid_t   gid;
 	umode_t mode;
+	int     page_shift;
 	long	nr_blocks;
 	long	nr_inodes;
 };


  reply	other threads:[~2006-04-14  2:23 UTC|newest]

Thread overview: 10+ 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: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 is_valid_hpage_size function Zou Nan hai
2006-04-14  0:41     ` Zou Nan hai [this message]
2006-04-14  0:45       ` [PATCH 4/8] IA64 various hugepage size - modify HPAGE related macros Zou Nan hai
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 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 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  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=1144975292.5817.74.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox