From: David Rientjes <rientjes@google.com>
To: Eric B Munson <ebmunson@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-man@vger.kernel.org, akpm@linux-foundation.org,
mtk.manpages@gmail.com
Subject: Re: [PATCH 1/3] hugetlbfs: Allow the creation of files suitable for MAP_PRIVATE on the vfs internal mount V3
Date: Fri, 14 Aug 2009 12:19:00 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.0908141218230.12472@chino.kir.corp.google.com> (raw)
In-Reply-To: <d2e4f6625a147c1ef6cb26de66849875f57a8155.1250258125.git.ebmunson@us.ibm.com>
On Fri, 14 Aug 2009, Eric B Munson wrote:
> There are two means of creating mappings backed by huge pages:
>
> 1. mmap() a file created on hugetlbfs
> 2. Use shm which creates a file on an internal mount which essentially
> maps it MAP_SHARED
>
> The internal mount is only used for shared mappings but there is very
> little that stops it being used for private mappings. This patch extends
> hugetlbfs_file_setup() to deal with the creation of files that will be
> mapped MAP_PRIVATE on the internal hugetlbfs mount. This extended API is
> used in a subsequent patch to implement the MAP_HUGETLB mmap() flag.
>
> Signed-off-by: Eric Munson <ebmunson@us.ibm.com>
> ---
> Changes from V2:
> Rebase to newest linux-2.6 tree
> Use base 10 value for HUGETLB_SHMFS_INODE instead of hex
>
> Changes from V1:
> Rebase to newest linux-2.6 tree
>
> fs/hugetlbfs/inode.c | 22 ++++++++++++++++++----
> include/linux/hugetlb.h | 10 +++++++++-
> ipc/shm.c | 3 ++-
> 3 files changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 941c842..361f536 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -506,6 +506,13 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
> inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
> INIT_LIST_HEAD(&inode->i_mapping->private_list);
> info = HUGETLBFS_I(inode);
> + /*
> + * The policy is initialized here even if we are creating a
> + * private inode because initialization simply creates an
> + * an empty rb tree and calls spin_lock_init(), later when we
> + * call mpol_free_shared_policy() it will just return because
> + * the rb tree will still be empty.
> + */
> mpol_shared_policy_init(&info->policy, NULL);
> switch (mode & S_IFMT) {
> default:
> @@ -930,12 +937,19 @@ static struct file_system_type hugetlbfs_fs_type = {
>
> static struct vfsmount *hugetlbfs_vfsmount;
>
> -static int can_do_hugetlb_shm(void)
> +static int can_do_hugetlb_shm(int creat_flags)
> {
> - return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
> + if (!(creat_flags & HUGETLB_SHMFS_INODE))
> + return 0;
That should be
if (creat_flags != HUGETLB_SHMFS_INODE)
return 0;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-08-14 19:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-14 14:08 [PATCH 0/3] Add pseudo-anonymous huge page mappings V3 Eric B Munson
2009-08-14 14:08 ` [PATCH 1/3] hugetlbfs: Allow the creation of files suitable for MAP_PRIVATE on the vfs internal mount V3 Eric B Munson
2009-08-14 14:08 ` [PATCH 2/3] Add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions V3 Eric B Munson
2009-08-14 14:08 ` [PATCH 3/3] Add MAP_HUGETLB example V3 Eric B Munson
2009-08-14 19:20 ` David Rientjes
2009-08-14 19:19 ` David Rientjes [this message]
2009-08-17 13:53 ` [PATCH 0/3] Add pseudo-anonymous huge page mappings V3 Andi Kleen
2009-08-18 10:53 ` Eric B Munson
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=alpine.DEB.2.00.0908141218230.12472@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=ebmunson@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtk.manpages@gmail.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