From: William Lee Irwin III <wli@holomorphy.com>
To: Muli Ben-Yehuda <mulix@mulix.org>,
David Gibson <david@gibson.dropbear.id.au>,
Andrew Morton <akpm@osdl.org>, Anton Blanchard <anton@samba.org>,
Adam Litke <agl@us.ibm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linux-kernel@vger.kernel.org, linuxppc64-dev@lists.linuxppc.org
Subject: Re: More convenient way to grab hugepage memory
Date: Thu, 13 May 2004 00:04:34 -0700 [thread overview]
Message-ID: <20040513070434.GS1397@holomorphy.com> (raw)
In-Reply-To: <20040513065912.GR1397@holomorphy.com>
On Wed, May 12, 2004 at 11:59:12PM -0700, William Lee Irwin III wrote:
> +#ifdef CONFIG_HUGETLB_PAGE
> +static inline int create_hugetlb_file(struct file **file, unsigned long flags)
That would be:
Index: wli-2.6.6-mm1/mm/mmap.c
===================================================================
--- wli-2.6.6-mm1.orig/mm/mmap.c 2004-05-12 23:29:53.000000000 -0700
+++ wli-2.6.6-mm1/mm/mmap.c 2004-05-13 00:02:36.000000000 -0700
@@ -771,6 +771,26 @@
return error;
}
+#ifdef CONFIG_HUGETLB_PAGE
+static inline int create_hugetlb_file(struct file **file, unsigned long flags,
+ unsigned long len)
+{
+ /* Create an implicit hugetlb file if necessary */
+ if (*file || !(flags & MAP_HUGETLB))
+ return 0;
+ else if (!IS_ERR(*file = hugetlb_zero_setup(len)))
+ return 0;
+ else
+ return PTR_ERR(*file);
+}
+#else
+static inline int create_hugetlb_file(struct file **file, unsigned long flags,
+ unsigned long len)
+{
+ return 0;
+}
+#endif
+
/*
* The caller must hold down_write(current->mm->mmap_sem).
*/
@@ -809,14 +829,10 @@
if (current->mm->map_count > sysctl_max_map_count)
return -ENOMEM;
- /* Create an implicit hugetlb file if necessary */
- if (!file && (flags & MAP_HUGETLB)) {
- file = hugetlb_file = hugetlb_zero_setup(len);
- if (IS_ERR(file))
- return PTR_ERR(file);
- }
-
- result = __do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+ if (!(result = create_hugetlb_file(&hugetlb_file, flags, len)))
+ result = __do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+ else
+ return result;
/* Drop reference to implicit hugetlb file, it's already been
* "gotten" in __do_mmap_pgoff in case of success
next prev parent reply other threads:[~2004-05-13 7:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-13 5:55 More convenient way to grab hugepage memory David Gibson
2004-05-13 6:05 ` Muli Ben-Yehuda
2004-05-13 6:20 ` David Gibson
2004-05-13 6:45 ` Roland Dreier
2004-05-13 6:59 ` William Lee Irwin III
2004-05-13 7:04 ` William Lee Irwin III [this message]
2004-05-13 7:11 ` William Lee Irwin III
2004-05-13 7:09 ` Benjamin Herrenschmidt
2004-05-13 7:13 ` William Lee Irwin III
2004-05-13 8:05 ` Muli Ben-Yehuda
2004-05-13 6:06 ` William Lee Irwin III
2004-05-13 6:27 ` William Lee Irwin III
2004-05-13 7:49 ` Christoph Hellwig
2004-05-13 8:06 ` Christoph Hellwig
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=20040513070434.GS1397@holomorphy.com \
--to=wli@holomorphy.com \
--cc=agl@us.ibm.com \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=david@gibson.dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@lists.linuxppc.org \
--cc=mulix@mulix.org \
/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.