[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330830176-19449-1-git-send-email-n-horiguchi@ah.jp.nec.com>
Date: Sat, 3 Mar 2012 22:02:56 -0500
From: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To: Steven Truelove <steven.truelove@...ronto.ca>
Cc: wli@...omorphy.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] Correct alignment of huge page requests.
On Thu, Mar 01, 2012 at 09:58:41PM -0500, Steven Truelove wrote:
> When calling shmget() with SHM_HUGETLB, shmget aligns the request size to PAGE_SIZE, but this is not sufficient. Modified hugetlb_file_setup() to align requests to the huge page size, and to accept an address argument so that all alignment checks can be performed in hugetlb_file_setup(), rather than in its callers. Changed newseg and mmap_pgoff to match new prototype and eliminated a now redundant alignment check.
I think only rounding up request size in shmget() is not sufficient,
because later shmat() also have alignment check and fails to mmap()
to unaligned address.
Maybe file->f_op->get_unmapped_area() (or hugetlb_get_unmapped_area())
should have round up code, I think.
Could you try it?
And a few comments below,
> Signed-off-by: Steven Truelove <steven.truelove@...ronto.ca>
> ---
> fs/hugetlbfs/inode.c | 12 ++++++++----
> include/linux/hugetlb.h | 3 ++-
> ipc/shm.c | 2 +-
> mm/mmap.c | 6 +++---
> 4 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 1e85a7a..a97b7cc 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -928,7 +928,7 @@ static int can_do_hugetlb_shm(void)
> return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
> }
>
> -struct file *hugetlb_file_setup(const char *name, size_t size,
> +struct file *hugetlb_file_setup(const char *name, unsigned long addr, size_t size,
Just a nitpick, this line is over 80 characters.
checkpatch.pl should warn.
> vm_flags_t acctflag,
> struct user_struct **user, int creat_flags)
> {
> @@ -938,6 +938,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
> struct path path;
> struct dentry *root;
> struct qstr quick_string;
> + struct hstate *hstate;
> + int num_pages;
Is unsigned long better?
Thanks,
Naoya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists