public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] shmat() and CONFIG_STACK_GROWSUP
Date: Thu, 11 Jan 2007 22:12:33 +0100	[thread overview]
Message-ID: <200701112212.34000.deller@gmx.de> (raw)

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

                 reply	other threads:[~2007-01-11 21:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200701112212.34000.deller@gmx.de \
    --to=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.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