public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] binfmt_elf_fdpic: Convert initial stack alignment to arch_align_stack().
Date: Tue, 29 Jul 2008 00:05:01 +0900	[thread overview]
Message-ID: <20080728150501.GC16555@linux-sh.org> (raw)
In-Reply-To: <20080728150430.GB16555@linux-sh.org>

binfmt_elf_fdpic seems to have grabbed a hard-coded hack from an ancient
version of binfmt_elf in order to try and fix up initial stack alignment
on multi-threaded x86, which while in addition to being unused, was also
pushed down beyond the first set of operations on the stack pointer,
negating the entire purpose.

These days, we have an architecture independent arch_align_stack(), so we
switch to using that instead. Move the initial alignment up before the
initial stores while we're at it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

---

 fs/binfmt_elf_fdpic.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 0955d03..bc64f5f 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -482,11 +482,18 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 	int loop;
 	int nr;	/* reset for each csp adjustment */
 
-	/* we're going to shovel a whole load of stuff onto the stack */
+	/*
+	 * we're going to shovel a whole load of stuff onto the stack
+	 *
+	 * In some cases (e.g. Hyper-Threading), we want to avoid L1
+	 * evictions by the processes running on the same package. One
+	 * thing we can do is to shuffle the initial stack for them, so
+	 * we give the architecture an opportunity to do so here.
+	 */
 #ifdef CONFIG_MMU
-	sp = bprm->p;
+	sp = arch_align_stack(bprm->p);
 #else
-	sp = mm->start_stack;
+	sp = arch_align_stack(mm->start_stack);
 
 	/* stack the program arguments and environment */
 	if (elf_fdpic_transfer_args_to_stack(bprm, &sp) < 0)
@@ -527,20 +534,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 			return -EFAULT;
 	}
 
-#if defined(__i386__) && defined(CONFIG_SMP)
-	/* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions
-	 * by the processes running on the same package. One thing we can do is
-	 * to shuffle the initial stack for them.
-	 *
-	 * the conditionals here are unneeded, but kept in to make the code
-	 * behaviour the same as pre change unless we have hyperthreaded
-	 * processors. This keeps Mr Marcelo Person happier but should be
-	 * removed for 2.5
-	 */
-	if (smp_num_siblings > 1)
-		sp = sp - ((current->pid % 64) << 7);
-#endif
-
 	sp &= ~7UL;
 
 	/* stack the load map(s) */

  reply	other threads:[~2008-07-28 15:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28 15:03 [PATCH 0/3] binfmt_elf_fdpic: auxvec updates Paul Mundt
2008-07-28 15:04 ` [PATCH 1/3] binfmt_elf_fdpic: Support auxvec base platform string Paul Mundt
2008-07-28 15:05   ` Paul Mundt [this message]
2008-07-28 15:05     ` [PATCH 3/3] binfmt_elf_fdpic: Wire up AT_EXECFD, AT_EXECFN, AT_SECURE Paul Mundt
2008-08-01 14:04       ` David Howells
2008-08-01 14:01     ` [PATCH 2/3] binfmt_elf_fdpic: Convert initial stack alignment to arch_align_stack() David Howells
2008-08-01 21:44       ` Paul Mundt
2008-08-04  3:24         ` Mike Frysinger
2008-08-04  4:00           ` Paul Mundt
2008-08-04 10:08             ` David Howells
2008-08-01 13:57   ` [PATCH 1/3] binfmt_elf_fdpic: Support auxvec base platform string David Howells
2008-08-01 21:46     ` Paul Mundt
  -- strict thread matches above, loose matches on Subject: below --
2008-08-06 10:34 [PATCH 0/3] binfmt_elf_fdpic: auxvec updates, v2 Paul Mundt
2008-08-06 10:36 ` [PATCH 2/3] binfmt_elf_fdpic: Convert initial stack alignment to arch_align_stack() Paul Mundt

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=20080728150501.GC16555@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@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