From: Andreas Schwab <schwab@linux-m68k.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, Anton Blanchard <anton@samba.org>
Subject: Re: [patch 1/3] powerpc: Move 64bit VDSO to improve context switch performance
Date: Sun, 04 Oct 2009 14:35:41 +0200 [thread overview]
Message-ID: <m2skdze3qa.fsf@igel.home> (raw)
In-Reply-To: <1254606807.7122.23.camel@pasglop> (Benjamin Herrenschmidt's message of "Sun, 04 Oct 2009 08:53:27 +1100")
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> Maybe a better fix is to force alignment in the kernel by requesting
> size + 64k - 4k and aligning it.
Sure you are right.
Andreas.
>From b9441a3d2148d439e2730def3222a7b70dccc432 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sun, 4 Oct 2009 14:29:04 +0200
Subject: [PATCH] powerpc: align vDSO base address
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
arch/powerpc/kernel/vdso.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 94e2df3..137dc22 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -50,6 +50,9 @@
/* Max supported size for symbol names */
#define MAX_SYMNAME 64
+/* The alignment of the vDSO */
+#define VDSO_ALIGNMENT (1 << 16)
+
extern char vdso32_start, vdso32_end;
static void *vdso32_kbase = &vdso32_start;
static unsigned int vdso32_pages;
@@ -231,15 +234,21 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
* pick a base address for the vDSO in process space. We try to put it
* at vdso_base which is the "natural" base for it, but we might fail
* and end up putting it elsewhere.
+ * Add enough to the size so that the result can be aligned.
*/
down_write(&mm->mmap_sem);
vdso_base = get_unmapped_area(NULL, vdso_base,
- vdso_pages << PAGE_SHIFT, 0, 0);
+ (vdso_pages << PAGE_SHIFT) +
+ ((VDSO_ALIGNMENT - 1) & PAGE_MASK),
+ 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
rc = vdso_base;
goto fail_mmapsem;
}
+ /* Add required alignment. */
+ vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT);
+
/*
* Put vDSO base into mm struct. We need to do this before calling
* install_special_mapping or the perf counter mmap tracking code
--
1.6.4.4
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2009-10-04 12:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 6:53 [patch 0/3] PowerPC context switch optimisations Anton Blanchard
2009-07-14 6:53 ` [patch 1/3] powerpc: Move 64bit VDSO to improve context switch performance Anton Blanchard
2009-07-14 7:07 ` Benjamin Herrenschmidt
2009-07-14 7:38 ` Anton Blanchard
2009-10-02 19:14 ` Andreas Schwab
[not found] ` <m2ocophale.fsf__34527.2158309401$1254511503$gmane$org@igel.home>
2009-10-03 14:15 ` Andreas Schwab
2009-10-03 14:51 ` Andreas Schwab
2009-10-03 21:53 ` Benjamin Herrenschmidt
2009-10-04 12:35 ` Andreas Schwab [this message]
2009-07-14 6:53 ` [patch 2/3] powerpc: Rearrange SLB preload code Anton Blanchard
2009-07-14 6:53 ` [patch 3/3] powerpc: Preload application text segment instead of TASK_UNMAPPED_BASE Anton Blanchard
2009-07-14 7:10 ` Benjamin Herrenschmidt
2009-07-14 7:27 ` Anton Blanchard
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=m2skdze3qa.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).