From: Matt Mackall <mpm@selenic.com>
To: Richard Kennedy <richard@rsk.demon.co.uk>
Cc: Christoph Lameter <cl@linux-foundation.org>,
penberg <penberg@cs.helsinki.fi>, linux-mm <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] slub: reduce total stack usage of slab_err & object_err
Date: Tue, 30 Sep 2008 13:33:06 -0500 [thread overview]
Message-ID: <1222799586.23159.57.camel@calx> (raw)
In-Reply-To: <1222796245.23159.38.camel@calx>
On Tue, 2008-09-30 at 12:37 -0500, Matt Mackall wrote:
> On Tue, 2008-09-30 at 17:20 +0100, Richard Kennedy wrote:
> > Yes, using vprintk is better but you still have this path :
> > ( with your patch applied)
> >
> > object_err -> slab_bug(208) -> printk(216)
> > instead of
> > object_err -> slab_bug_message(8) -> printk(216)
> >
> > unfortunately the overhead for having var_args is pretty big, at least
> > on x86_64. I haven't measured it on 32 bit yet.
>
> That's fascinating. I tried a simple test case in userspace:
>
> #include <stdarg.h>
> #include <stdio.h>
>
> void p(char *fmt, ...)
> {
> va_list args;
>
> va_start(args, fmt);
> vprintf(fmt, args);
> va_end(args);
> }
>
> On 32-bit, I'm seeing 32 bytes of stack vs 216 on 64-bit. Disassembly
> suggests it's connected to va_list fiddling with XMM registers, which
> seems quite odd.
Ok, on closer inspection, this is part of the x86_64 calling convention.
When calling a varargs function, the caller passes the number of
floating point SSE regs used in rax. The callee then has to save these
away for va_list use. The GCC prologue apparently sets aside space for
xmm0-xmm7 (16 bytes each) all the time (plus rdi, rsi, rdx, rcx, r8, and
r9).
Obviously, we're never passing floating point args in the kernel, so
we're taking about a 40+ byte hit in code size and 128 byte hit in stack
size for every varargs call.
Looks like the gcc people have a patch in progress:
http://gcc.gnu.org/ml/gcc-patches/2008-08/msg02165.html
So I think we should assume that x86_64 will sort this out eventually.
--
Mathematics is the supreme nostalgia of our time.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-09-30 18:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 15:15 Richard Kennedy
2008-09-30 15:32 ` Matt Mackall
2008-09-30 15:38 ` Christoph Lameter
2008-09-30 15:49 ` Matt Mackall
2008-09-30 16:20 ` Richard Kennedy
2008-09-30 16:43 ` Matt Mackall
2008-09-30 17:36 ` Christoph Lameter
2008-09-30 17:37 ` Matt Mackall
2008-09-30 18:33 ` Matt Mackall [this message]
2008-10-01 9:50 ` Richard Kennedy
2008-10-01 0:02 ` Matt Mackall
2008-09-30 19:33 ` Jörn Engel
2008-10-01 10:06 ` Richard Kennedy
2008-10-01 10:32 ` Jörn Engel
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=1222799586.23159.57.camel@calx \
--to=mpm@selenic.com \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=richard@rsk.demon.co.uk \
/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