From: Adam Litke <agl@us.ibm.com>
To: Andy Whitcroft <apw@shadowen.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
wli@holomorphy.com, kenchen@google.com, dwg@au1.ibm.com,
andi@firstfloor.org, Mel Gorman <mel@csn.ul.ie>,
dean@arctic.org, abh@cray.com
Subject: Re: [PATCH 3/3] hugetlb-allow-huge-page-mappings-to-be-created-without-reservations
Date: Wed, 28 May 2008 15:53:10 -0500 [thread overview]
Message-ID: <1212007990.12036.75.camel@localhost.localdomain> (raw)
In-Reply-To: <1211929806.0@pinky>
On Wed, 2008-05-28 at 00:10 +0100, Andy Whitcroft wrote:
> By default all shared mappings and most private mappings now
> have reservations associated with them. This improves semantics by
> providing allocation guarentees to the mapper. However a small number of
> applications may attempt to make very large sparse mappings, with these
> strict reservations the system will never be able to honour the mapping.
>
> This patch set brings MAP_NORESERVE support to hugetlb files.
> This allows new mappings to be made to hugetlbfs files without an
> associated reservation, for both shared and private mappings. This allows
> applications which want to create very sparse mappings to opt-out of the
> reservation system. Obviously as there is no reservation they are liable
> to fault at runtime if the huge page pool becomes exhausted; buyer beware.
>
> Signed-off-by: Andy Whitcroft <apw@shadowen.org>
> ---
> mm/hugetlb.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 55 insertions(+), 5 deletions(-)
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 90a7f5f..118dc54 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -88,6 +88,9 @@ static int is_vma_resv_set(struct vm_area_struct *vma, unsigned long flag)
> /* Decrement the reserved pages in the hugepage pool by one */
> static void decrement_hugepage_resv_vma(struct vm_area_struct *vma)
> {
> + if (vma->vm_flags & VM_NORESERVE)
> + return;
> +
> if (vma->vm_flags & VM_SHARED) {
> /* Shared mappings always use reserves */
> resv_huge_pages--;
> @@ -682,25 +685,67 @@ static long region_truncate(struct list_head *head, long end)
> return chg;
> }
>
> +/*
> + * Determine if the huge page at addr within the vma has an associated
> + * reservation. Where it does not we will need to logically increase
> + * reservation and actually increase quota before an allocation can occur.
> + * Where any new reservation would be required the reservation change is
> + * prepared, but not committed. Once the page has been quota'd allocated
> + * an instantiated the change should be committed via vma_commit_reservation.
> + * No action is required on failure.
> + */
> +static int vma_needs_reservation(struct vm_area_struct *vma, unsigned long addr)
To me, this function has an odd name and led to some confusion when I
read the patch. This naming suggests that the function determines
_whether_or_not_ a particular page requires a reservation when in fact
it is determining a number of pages required and then (to use your
wording in the comments) prepares said reservation. Could we rename it
to vma_prepare_reservation() or something? I feel that would also align
it with vma_commit_reservation() a bit more.
--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center
--
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:[~2008-05-28 20:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 23:09 [PATCH 0/3] MAP_NORESERVE for hugetlb mappings V3 Andy Whitcroft
2008-05-27 23:09 ` [PATCH 1/3] record MAP_NORESERVE status on vmas and fix small page mprotect reservations Andy Whitcroft
2008-05-27 23:09 ` [PATCH 2/3] hugetlb-move-reservation-region-support-earlier Andy Whitcroft
2008-05-28 20:38 ` Adam Litke
2008-05-27 23:10 ` [PATCH 3/3] hugetlb-allow-huge-page-mappings-to-be-created-without-reservations Andy Whitcroft
2008-05-28 20:53 ` Adam Litke [this message]
2008-05-29 1:51 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2008-05-20 16:54 [PATCH 0/3] MAP_NORESERVE for hugetlb mappings V2 Andy Whitcroft
2008-05-20 16:55 ` [PATCH 3/3] hugetlb-allow-huge-page-mappings-to-be-created-without-reservations Andy Whitcroft
2008-05-07 20:24 [PATCH 0/3] MAP_NORESERVE for hugetlb mappings V1 Andy Whitcroft
2008-05-07 20:25 ` [PATCH 3/3] hugetlb-allow-huge-page-mappings-to-be-created-without-reservations Andy Whitcroft
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=1212007990.12036.75.camel@localhost.localdomain \
--to=agl@us.ibm.com \
--cc=abh@cray.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=apw@shadowen.org \
--cc=dean@arctic.org \
--cc=dwg@au1.ibm.com \
--cc=kenchen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).