linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] [RFC] slub tracing: move trace calls out of always inlined functions to reduce kernel code size
Date: Thu, 14 Oct 2010 10:49:29 +0100	[thread overview]
Message-ID: <1287049769.1909.4.camel@castor.rsk> (raw)
In-Reply-To: <4CB6ACB7.8060006@kernel.org>

On Thu, 2010-10-14 at 10:09 +0300, Pekka Enberg wrote:
> On 10/13/10 7:09 PM, Richard Kennedy wrote:
> > Having the trace calls defined in the always inlined kmalloc functions
> > in include/linux/slub_def.h causes a lot of code duplication as the
> > trace functions get instantiated for each kamalloc call site. This can
> > simply be removed by pushing the trace calls down into the functions in
> > slub.c.
> >
> > On my x86_64 built this patch shrinks the code size of the kernel by
> > approx 29K and also shrinks the code size of many modules -- too many to
> > list here ;)
> >
> > size vmlinux.o reports
> >         text	   data	    bss	    dec	    hex	filename
> >      4777011	 602052	 763072	6142135	 5db8b7	vmlinux.o
> >      4747120	 602388	 763072	6112580	 5d4544	vmlinux.o.patch
> 
> Impressive kernel text savings!
> 
> > index 13fffe1..32b89ee 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > +void *kmalloc_order(size_t size, gfp_t flags, unsigned int order)
> > +{
> > +	void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);
> > +
> > +	kmemleak_alloc(ret, size, 1, flags);
> > +	trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE<<  order, flags);
> > +
> > +	return ret;
> > +}
> > +EXPORT_SYMBOL(kmalloc_order);
> > +
> This doesn't make sense to be out-of-line for the !CONFIG_TRACE case. 
> I'd just wrap that with "#ifdef CONFIG_TRACE" and put an inline version 
> in the header for !TRACE.
> 
>              Pekka

Yes, OK I'll do that.
regards
Richard

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

  reply	other threads:[~2010-10-14  9:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-13 16:09 [PATCH] [RFC] slub tracing: move trace calls out of always inlined functions to reduce kernel code size Richard Kennedy
2010-10-14  7:09 ` Pekka Enberg
2010-10-14  9:49   ` Richard Kennedy [this message]
2010-10-21  9:29     ` [PATCH] [v2] " Richard Kennedy
2010-10-26 17:43       ` Pekka Enberg

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=1287049769.1909.4.camel@castor.rsk \
    --to=richard@rsk.demon.co.uk \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rostedt@goodmis.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).