linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arch@vger.kernel.org,
	Linux Memory Management <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 13/14] get_unmapped_area handles MAP_FIXED in generic code
Date: Wed, 04 Apr 2007 14:02:21 +1000	[thread overview]
Message-ID: <20070404040232.AAF99DDEBB@ozlabs.org> (raw)
In-Reply-To: <1175659331.690672.592289266160.qpush@grosgo>

and change the caller now that everybody can handle it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 mm/mmap.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

Index: linux-cell/mm/mmap.c
===================================================================
--- linux-cell.orig/mm/mmap.c	2007-03-22 16:29:22.000000000 +1100
+++ linux-cell/mm/mmap.c	2007-03-22 16:30:06.000000000 +1100
@@ -1199,6 +1199,9 @@ arch_get_unmapped_area(struct file *filp
 	if (len > TASK_SIZE)
 		return -ENOMEM;
 
+	if (flags & MAP_FIXED)
+		return addr;
+
 	if (addr) {
 		addr = PAGE_ALIGN(addr);
 		vma = find_vma(mm, addr);
@@ -1272,6 +1275,9 @@ arch_get_unmapped_area_topdown(struct fi
 	if (len > TASK_SIZE)
 		return -ENOMEM;
 
+	if (flags & MAP_FIXED)
+		return addr;
+
 	/* requesting a specific address */
 	if (addr) {
 		addr = PAGE_ALIGN(addr);
@@ -1360,22 +1366,21 @@ get_unmapped_area(struct file *file, uns
 		unsigned long pgoff, unsigned long flags)
 {
 	unsigned long ret;
+	unsigned long (*get_area)(struct file *, unsigned long,
+				  unsigned long, unsigned long, unsigned long);
 
-	if (!(flags & MAP_FIXED)) {
-		unsigned long (*get_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
-
-		get_area = current->mm->get_unmapped_area;
-		if (file && file->f_op && file->f_op->get_unmapped_area)
-			get_area = file->f_op->get_unmapped_area;
-		addr = get_area(file, addr, len, pgoff, flags);
-		if (IS_ERR_VALUE(addr))
-			return addr;
-	}
+	get_area = current->mm->get_unmapped_area;
+	if (file && file->f_op && file->f_op->get_unmapped_area)
+		get_area = file->f_op->get_unmapped_area;
+	addr = get_area(file, addr, len, pgoff, flags);
+	if (IS_ERR_VALUE(addr))
+		return addr;
 
 	if (addr > TASK_SIZE - len)
 		return -ENOMEM;
 	if (addr & ~PAGE_MASK)
 		return -EINVAL;
+
 	if (file && is_file_hugepages(file))  {
 		/*
 		 * Check if the given range is hugepage aligned, and

--
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>

  parent reply	other threads:[~2007-04-04  4:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04  4:02 [PATCH 0/14] Pass MAP_FIXED down to get_unmapped_area Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 1/14] get_unmapped_area handles MAP_FIXED on powerpc Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 2/14] get_unmapped_area handles MAP_FIXED on alpha Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 3/14] get_unmapped_area handles MAP_FIXED on arm Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 4/14] get_unmapped_area handles MAP_FIXED on frv Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 6/14] get_unmapped_area handles MAP_FIXED on ia64 Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 5/14] get_unmapped_area handles MAP_FIXED on i386 Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 7/14] get_unmapped_area handles MAP_FIXED on parisc Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 9/14] get_unmapped_area handles MAP_FIXED on x86_64 Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 8/14] get_unmapped_area handles MAP_FIXED on sparc64 Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 10/14] get_unmapped_area handles MAP_FIXED in hugetlbfs Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 11/14] get_unmapped_area handles MAP_FIXED on ramfs (nommu) Benjamin Herrenschmidt
2007-04-04 10:16   ` David Howells
2007-04-04 23:13     ` Benjamin Herrenschmidt
2007-04-04  4:02 ` [PATCH 12/14] get_unmapped_area handles MAP_FIXED in /dev/mem (nommu) Benjamin Herrenschmidt
2007-04-04 10:31   ` David Howells
2007-04-04 23:14     ` Benjamin Herrenschmidt
2007-04-04  4:02 ` Benjamin Herrenschmidt [this message]
2007-04-04  4:02 ` [PATCH 14/14] get_unmapped_area doesn't need hugetlbfs hacks anymore Benjamin Herrenschmidt
2007-04-04 10:31 ` [PATCH 0/14] Pass MAP_FIXED down to get_unmapped_area David Howells
2007-04-04 23:20   ` Benjamin Herrenschmidt

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=20070404040232.AAF99DDEBB@ozlabs.org \
    --to=benh@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox