All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Steven Truelove <steven.truelove@utoronto.ca>
Cc: wli@holomorphy.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] HUGETLBFS: Align memory request to multiple of huge page size to avoid underallocating.
Date: Mon, 27 Feb 2012 19:04:32 -0800	[thread overview]
Message-ID: <20120227190432.55d7399a.akpm@linux-foundation.org> (raw)
In-Reply-To: <4F4C4215.5020108@utoronto.ca>

On Mon, 27 Feb 2012 21:55:17 -0500 Steven Truelove <steven.truelove@utoronto.ca> wrote:

> > A few things...
> >
> > - sys_mmap_pgoff() does the rounding up prior to calling
> >    hugetlb_file_setup().  ipc/shm.c:newseg() does not.
> >
> >    We should be consistent here: do it in the caller or the callee,
> >    not both (or neither!).  I guess doing it in the callee would be
> >    best.
> >
> > - The above code could/should have used ALIGN().  Or round_up(): the
> >    difference presently escapes me, even though it was so obvious that
> >    we left all these things undocumented.
> >
> > - What's the point in aligning the length if we don't also look at
> >    the start address?  If that isn't a multiple of huge_page_size(), we
> >    will need an additional page.
> >
> 
> Since mmap has an address to check and shmget does not, if the address 
> is going to be checked it will need to be in the caller.

Or pass a value of 0 from shmget.

>  If you like, I 
> will leave the size check in hugetlb_file_setup() and remove the size 
> check from mmap_pgoff, but replace it with a check of the address.  That 
> will centralize the common check (size of buffer), and let mmap_pgoff 
> check the part that is unique to it.  Patch shortly.
> 
> Steven Truelove

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Steven Truelove <steven.truelove@utoronto.ca>
Cc: wli@holomorphy.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] HUGETLBFS: Align memory request to multiple of huge page size to avoid underallocating.
Date: Mon, 27 Feb 2012 19:04:32 -0800	[thread overview]
Message-ID: <20120227190432.55d7399a.akpm@linux-foundation.org> (raw)
In-Reply-To: <4F4C4215.5020108@utoronto.ca>

On Mon, 27 Feb 2012 21:55:17 -0500 Steven Truelove <steven.truelove@utoronto.ca> wrote:

> > A few things...
> >
> > - sys_mmap_pgoff() does the rounding up prior to calling
> >    hugetlb_file_setup().  ipc/shm.c:newseg() does not.
> >
> >    We should be consistent here: do it in the caller or the callee,
> >    not both (or neither!).  I guess doing it in the callee would be
> >    best.
> >
> > - The above code could/should have used ALIGN().  Or round_up(): the
> >    difference presently escapes me, even though it was so obvious that
> >    we left all these things undocumented.
> >
> > - What's the point in aligning the length if we don't also look at
> >    the start address?  If that isn't a multiple of huge_page_size(), we
> >    will need an additional page.
> >
> 
> Since mmap has an address to check and shmget does not, if the address 
> is going to be checked it will need to be in the caller.

Or pass a value of 0 from shmget.

>  If you like, I 
> will leave the size check in hugetlb_file_setup() and remove the size 
> check from mmap_pgoff, but replace it with a check of the address.  That 
> will centralize the common check (size of buffer), and let mmap_pgoff 
> check the part that is unique to it.  Patch shortly.
> 
> Steven Truelove

  reply	other threads:[~2012-02-28  3:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 14:09 [PATCH] HUGETLBFS: Align memory request to multiple of huge page size to avoid underallocating Steven Truelove
2012-02-27 23:42 ` Andrew Morton
2012-02-27 23:42   ` Andrew Morton
2012-02-28  2:55   ` Steven Truelove
2012-02-28  2:55     ` Steven Truelove
2012-02-28  3:04     ` Andrew Morton [this message]
2012-02-28  3:04       ` Andrew Morton

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=20120227190432.55d7399a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=steven.truelove@utoronto.ca \
    --cc=wli@holomorphy.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.