All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Richard Kennedy <richard@rsk.demon.co.uk>
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] [v2] slub tracing: move trace calls out of always inlined functions to reduce kernel code size
Date: Tue, 26 Oct 2010 20:43:33 +0300	[thread overview]
Message-ID: <4CC71345.9050907@kernel.org> (raw)
In-Reply-To: <1287653359.1906.13.camel@castor.rsk>

On 21.10.2010 12.29, 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 36K and also shrinks the code size of many modules -- too many to
> list here ;)
>
> size vmlinux (2.6.36) reports
>         text        data     bss     dec     hex filename
>      5410611	 743172	 828928	6982711	 6a8c37	vmlinux
>      5373738	 744244	 828928	6946910	 6a005e	vmlinux + patch
>
> The resulting kernel has had some testing&  kmalloc trace still seems to
> work.
>
> This patch
> - moves trace_kmalloc out of the inlined kmalloc() and pushes it down
> into kmem_cache_alloc_trace() so this it only get instantiated once.
>
> - rename kmem_cache_alloc_notrace()  to kmem_cache_alloc_trace() to
> indicate that now is does have tracing. (maybe this would better being
> called something like kmalloc_kmem_cache ?)
>
> - adds a new function kmalloc_order() to handle allocation and tracing
> of large allocations of page order.
>
> - removes tracing from the inlined kmalloc_large() replacing them with a
> call to kmalloc_order();
>
> - move tracing out of inlined kmalloc_node() and pushing it down into
> kmem_cache_alloc_node_trace
>
> - rename kmem_cache_alloc_node_notrace() to
> kmem_cache_alloc_node_trace()
>
> - removes the include of trace/events/kmem.h from slub_def.h.
>
> v2
> - keep kmalloc_order_trace inline when !CONFIG_TRACE
>
> Signed-off-by: Richard Kennedy<richard@rsk.demon.co.uk>

Applied, thanks!

WARNING: multiple messages have this Message-ID (diff)
From: Pekka Enberg <penberg@kernel.org>
To: Richard Kennedy <richard@rsk.demon.co.uk>
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] [v2] slub tracing: move trace calls out of always inlined functions to reduce kernel code size
Date: Tue, 26 Oct 2010 20:43:33 +0300	[thread overview]
Message-ID: <4CC71345.9050907@kernel.org> (raw)
In-Reply-To: <1287653359.1906.13.camel@castor.rsk>

On 21.10.2010 12.29, 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 36K and also shrinks the code size of many modules -- too many to
> list here ;)
>
> size vmlinux (2.6.36) reports
>         text        data     bss     dec     hex filename
>      5410611	 743172	 828928	6982711	 6a8c37	vmlinux
>      5373738	 744244	 828928	6946910	 6a005e	vmlinux + patch
>
> The resulting kernel has had some testing&  kmalloc trace still seems to
> work.
>
> This patch
> - moves trace_kmalloc out of the inlined kmalloc() and pushes it down
> into kmem_cache_alloc_trace() so this it only get instantiated once.
>
> - rename kmem_cache_alloc_notrace()  to kmem_cache_alloc_trace() to
> indicate that now is does have tracing. (maybe this would better being
> called something like kmalloc_kmem_cache ?)
>
> - adds a new function kmalloc_order() to handle allocation and tracing
> of large allocations of page order.
>
> - removes tracing from the inlined kmalloc_large() replacing them with a
> call to kmalloc_order();
>
> - move tracing out of inlined kmalloc_node() and pushing it down into
> kmem_cache_alloc_node_trace
>
> - rename kmem_cache_alloc_node_notrace() to
> kmem_cache_alloc_node_trace()
>
> - removes the include of trace/events/kmem.h from slub_def.h.
>
> v2
> - keep kmalloc_order_trace inline when !CONFIG_TRACE
>
> Signed-off-by: Richard Kennedy<richard@rsk.demon.co.uk>

Applied, thanks!

--
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-26 17:43 UTC|newest]

Thread overview: 10+ 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-13 16:09 ` Richard Kennedy
2010-10-14  7:09 ` Pekka Enberg
2010-10-14  7:09   ` Pekka Enberg
2010-10-14  9:49   ` Richard Kennedy
2010-10-14  9:49     ` Richard Kennedy
2010-10-21  9:29     ` [PATCH] [v2] " Richard Kennedy
2010-10-21  9:29       ` Richard Kennedy
2010-10-26 17:43       ` Pekka Enberg [this message]
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=4CC71345.9050907@kernel.org \
    --to=penberg@kernel.org \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=richard@rsk.demon.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.