linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 8/18] file ->get_unmapped_area() shouldn't duplicate work of get_unmapped_area()
@ 2009-12-05 19:08 Al Viro
  2009-12-05 23:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2009-12-05 19:08 UTC (permalink / raw)
  To: linux-arch; +Cc: torvalds, linux-kernel


... we should call mm ->get_unmapped_area() instead and let our caller
do the final checks.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/sparc/kernel/sys_sparc_64.c |   10 +++++++---
 ipc/shm.c                        |    2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index ddda12f..d498b32 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -317,10 +317,14 @@ bottomup:
 unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
 {
 	unsigned long align_goal, addr = -ENOMEM;
+	unsigned long (*get_area)(struct file *, unsigned long,
+				  unsigned long, unsigned long, unsigned long);
+
+	get_area = current->mm->get_unmapped_area;
 
 	if (flags & MAP_FIXED) {
 		/* Ok, don't mess with it. */
-		return get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
+		return get_area(NULL, orig_addr, len, pgoff, flags);
 	}
 	flags &= ~MAP_SHARED;
 
@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
 		align_goal = (64UL * 1024);
 
 	do {
-		addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
+		addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
 		if (!(addr & ~PAGE_MASK)) {
 			addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
 			break;
@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
 	 * be obtained.
 	 */
 	if (addr & ~PAGE_MASK)
-		addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
+		addr = get_area(NULL, orig_addr, len, pgoff, flags);
 
 	return addr;
 }
diff --git a/ipc/shm.c b/ipc/shm.c
index 464694e..7e50727 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -290,7 +290,7 @@ static unsigned long shm_get_unmapped_area(struct file *file,
 	unsigned long flags)
 {
 	struct shm_file_data *sfd = shm_file_data(file);
-	return get_unmapped_area(sfd->file, addr, len, pgoff, flags);
+	return current->mm->get_unmapped_area(sfd->file, addr, len, pgoff, flags);
 }
 
 int is_file_shm_hugepages(struct file *file)
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC][PATCH 8/18] file ->get_unmapped_area() shouldn't duplicate work of get_unmapped_area()
  2009-12-05 19:08 [RFC][PATCH 8/18] file ->get_unmapped_area() shouldn't duplicate work of get_unmapped_area() Al Viro
@ 2009-12-05 23:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-12-05 23:10 UTC (permalink / raw)
  To: viro; +Cc: linux-arch, torvalds, linux-kernel

From: Al Viro <viro@ftp.linux.org.uk>
Date: Sat, 05 Dec 2009 19:08:50 +0000

> 
> ... we should call mm ->get_unmapped_area() instead and let our caller
> do the final checks.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-05 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-05 19:08 [RFC][PATCH 8/18] file ->get_unmapped_area() shouldn't duplicate work of get_unmapped_area() Al Viro
2009-12-05 23:10 ` David Miller

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