[PATCH] shmat() and CONFIG_STACK_GROWSUP
- From: Helge Deller <deller@xxxxxx>
- Date: Thu, 11 Jan 2007 22:12:33 +0100
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.
Helge
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;
+#ifndef CONFIG_STACK_GROWSUP
/*
* 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;
+#endif
}
user_addr = (void*) do_mmap (file, addr, size, prot, flags, 0);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Prev by Date: Re: DMA problems in ide-scsi
- Next by Date: Re: [Suspend-devel] asus p5ld2 se, serial port gone after suspend and i8042 problems (solved, pnpacpi=off needed)
- Previous by thread: [PATCH] [UPDATED] ext3: refuse ro to rw remount of fs with orphan inodes
- Next by thread: [PATCH] seq_file conversion: APM on i386
- Index(es):
Relevant Pages
|