LKML Archive on
help / color / mirror / Atom feed
@ 2007-01-11 21:12 Helge Deller
  0 siblings, 0 replies; only message in thread
From: Helge Deller @ 2007-01-11 21:12 UTC (permalink / raw)
  To: Kernel Mailing List

On PARISC-Linux the stack grows up, which is why on this platform CONFIG_STACK_GROWSUP is #defined by default.
The patch below allows shmat() to map the requested memory region on this platform directly below the start of the stack, without the need to reserve memory for a downward-growing stack.
Basically it gains a small region of 4 Pages in which shmat() may map memory on this platform.


diff --git a/ipc/shm.c b/ipc/shm.c
index 6d16bb6..f5cc635 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -852,6 +852,7 @@ long do_shmat(int shmid, char __user *sh
 		user_addr = ERR_PTR(-EINVAL);
 		if (find_vma_intersection(current->mm, addr, addr + size))
 			goto invalid;
 		 * If shm segment goes below stack, make sure there is some
 		 * space left for the stack to grow (at least 4 pages).
@@ -859,6 +860,7 @@ long do_shmat(int shmid, char __user *sh
 		if (addr < current->mm->start_stack &&
 		    addr > current->mm->start_stack - size - PAGE_SIZE * 5)
 			goto invalid;
 	user_addr = (void*) do_mmap (file, addr, size, prot, flags, 0);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-11 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-11 21:12 [PATCH] shmat() and CONFIG_STACK_GROWSUP Helge Deller

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