All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	mathieu.desnoyers@polymtl.ca, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, rdunlap@xenotime.net,
	mpm@selenic.com, rostedt@goodmis.org, tglx@linutronix.de
Subject: Re: [PATCH 4/5] kmemtrace: SLUB hooks.
Date: Tue, 12 Aug 2008 18:25:49 +0300	[thread overview]
Message-ID: <20080812152548.GA5973@localhost> (raw)
In-Reply-To: <1218463774.7813.291.camel@penberg-laptop>

On Mon, Aug 11, 2008 at 05:09:34PM +0300, Pekka Enberg wrote:
> On Mon, 2008-08-11 at 09:04 -0500, Christoph Lameter wrote:
> > Eduard - Gabriel Munteanu wrote:
> > 
> > 
> > 
> > >  static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
> > >  {
> > > +	void *ret;
> > > +
> > >  	if (__builtin_constant_p(size) &&
> > >  		size <= PAGE_SIZE && !(flags & SLUB_DMA)) {
> > >  			struct kmem_cache *s = kmalloc_slab(size);
> > > @@ -239,7 +280,13 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
> > >  		if (!s)
> > >  			return ZERO_SIZE_PTR;
> > >  
> > > -		return kmem_cache_alloc_node(s, flags, node);
> > > +		ret = kmem_cache_alloc_node_notrace(s, flags, node);
> > > +
> > > +		kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
> > > +					  _THIS_IP_, ret,
> > > +					  size, s->size, flags, node);
> > > +
> > > +		return ret;
> > 
> > You could simplify the stuff in slub.h if you would fall back to the uninlined
> > functions in the case that kmemtrace is enabled. IMHO adding additional inline
> > code here does grow these function to a size where inlining is not useful anymore.
> 
> So, if CONFIG_KMEMTRACE is enabled, make the inlined version go away
> completely? I'm okay with that though I wonder if that means we now take
> a performance hit when CONFIG_KMEMTRACE is enabled but tracing is
> disabled at run-time...

Oh, good. I'm also thinking to add a macro that expands to simple inline when
CONFIG_KMEMTRACE is disabled and to __always_inline otherwise.

> > > +	kmemtrace_mark_alloc(KMEMTRACE_TYPE_CACHE, _RET_IP_, ret,
> > > +			     s->objsize, s->size, gfpflags);
> > > +
> > > +	return ret;
> > >  }
> > 
> > _RET_IP == __builtin_return_address(0) right? Put that into a local variable?
> > At least we need consistent usage within one function. Maybe convert
> > __builtin_return_address(0) to _RET_IP_ within slub?
> 
> I think we should just convert SLUB to use _RET_IP_ everywhere. Eduard,
> care to make a patch and send it and rebase this on top of that?

Sure. Will get back soon.


WARNING: multiple messages have this Message-ID (diff)
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	mathieu.desnoyers@polymtl.ca, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, rdunlap@xenotime.net,
	mpm@selenic.com, rostedt@goodmis.org, tglx@linutronix.de
Subject: Re: [PATCH 4/5] kmemtrace: SLUB hooks.
Date: Tue, 12 Aug 2008 18:25:49 +0300	[thread overview]
Message-ID: <20080812152548.GA5973@localhost> (raw)
In-Reply-To: <1218463774.7813.291.camel@penberg-laptop>

On Mon, Aug 11, 2008 at 05:09:34PM +0300, Pekka Enberg wrote:
> On Mon, 2008-08-11 at 09:04 -0500, Christoph Lameter wrote:
> > Eduard - Gabriel Munteanu wrote:
> > 
> > 
> > 
> > >  static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
> > >  {
> > > +	void *ret;
> > > +
> > >  	if (__builtin_constant_p(size) &&
> > >  		size <= PAGE_SIZE && !(flags & SLUB_DMA)) {
> > >  			struct kmem_cache *s = kmalloc_slab(size);
> > > @@ -239,7 +280,13 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
> > >  		if (!s)
> > >  			return ZERO_SIZE_PTR;
> > >  
> > > -		return kmem_cache_alloc_node(s, flags, node);
> > > +		ret = kmem_cache_alloc_node_notrace(s, flags, node);
> > > +
> > > +		kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
> > > +					  _THIS_IP_, ret,
> > > +					  size, s->size, flags, node);
> > > +
> > > +		return ret;
> > 
> > You could simplify the stuff in slub.h if you would fall back to the uninlined
> > functions in the case that kmemtrace is enabled. IMHO adding additional inline
> > code here does grow these function to a size where inlining is not useful anymore.
> 
> So, if CONFIG_KMEMTRACE is enabled, make the inlined version go away
> completely? I'm okay with that though I wonder if that means we now take
> a performance hit when CONFIG_KMEMTRACE is enabled but tracing is
> disabled at run-time...

Oh, good. I'm also thinking to add a macro that expands to simple inline when
CONFIG_KMEMTRACE is disabled and to __always_inline otherwise.

> > > +	kmemtrace_mark_alloc(KMEMTRACE_TYPE_CACHE, _RET_IP_, ret,
> > > +			     s->objsize, s->size, gfpflags);
> > > +
> > > +	return ret;
> > >  }
> > 
> > _RET_IP == __builtin_return_address(0) right? Put that into a local variable?
> > At least we need consistent usage within one function. Maybe convert
> > __builtin_return_address(0) to _RET_IP_ within slub?
> 
> I think we should just convert SLUB to use _RET_IP_ everywhere. Eduard,
> care to make a patch and send it and rebase this on top of that?

Sure. Will get back soon.

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

  parent reply	other threads:[~2008-08-12 15:28 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-10 17:14 [PATCH 0/5] kmemtrace Eduard - Gabriel Munteanu
2008-08-10 17:14 ` Eduard - Gabriel Munteanu
2008-08-10 17:14 ` [PATCH 1/5] kmemtrace: Core implementation Eduard - Gabriel Munteanu
2008-08-10 17:14   ` Eduard - Gabriel Munteanu
2008-08-10 17:14   ` [PATCH 2/5] kmemtrace: Additional documentation Eduard - Gabriel Munteanu
2008-08-10 17:14     ` Eduard - Gabriel Munteanu
2008-08-10 17:14     ` [PATCH 3/5] kmemtrace: SLAB hooks Eduard - Gabriel Munteanu
2008-08-10 17:14       ` Eduard - Gabriel Munteanu
2008-08-10 17:14       ` [PATCH 4/5] kmemtrace: SLUB hooks Eduard - Gabriel Munteanu
2008-08-10 17:14         ` Eduard - Gabriel Munteanu
2008-08-10 17:14         ` [PATCH 5/5] kmemtrace: SLOB hooks Eduard - Gabriel Munteanu
2008-08-10 17:14           ` Eduard - Gabriel Munteanu
2008-08-10 17:48           ` Pekka Enberg
2008-08-10 17:48             ` Pekka Enberg
2008-08-10 23:18             ` Matt Mackall
2008-08-10 23:18               ` Matt Mackall
2008-08-12  6:46               ` Pekka Enberg
2008-08-12  6:46                 ` Pekka Enberg
2008-08-11 14:04         ` [PATCH 4/5] kmemtrace: SLUB hooks Christoph Lameter
2008-08-11 14:04           ` Christoph Lameter
2008-08-11 14:09           ` Pekka Enberg
2008-08-11 14:09             ` Pekka Enberg
2008-08-11 14:13             ` Christoph Lameter
2008-08-11 14:13               ` Christoph Lameter
2008-08-11 14:16               ` Pekka Enberg
2008-08-11 14:16                 ` Pekka Enberg
2008-08-11 14:21                 ` Christoph Lameter
2008-08-11 14:21                   ` Christoph Lameter
2008-08-11 14:22                   ` Pekka Enberg
2008-08-11 14:22                     ` Pekka Enberg
2008-08-12 15:29                     ` Eduard - Gabriel Munteanu
2008-08-12 15:29                       ` Eduard - Gabriel Munteanu
2008-08-12 15:43                       ` Mathieu Desnoyers
2008-08-12 15:43                         ` Mathieu Desnoyers
2008-08-13  2:09                       ` Matt Mackall
2008-08-13  2:09                         ` Matt Mackall
2008-08-11 14:36                   ` Steven Rostedt
2008-08-11 14:36                     ` Steven Rostedt
2008-08-11 18:28                     ` Mathieu Desnoyers
2008-08-11 18:28                       ` Mathieu Desnoyers
2008-08-11 14:30               ` Steven Rostedt
2008-08-11 14:30                 ` Steven Rostedt
2008-08-11 14:37                 ` Christoph Lameter
2008-08-11 14:37                   ` Christoph Lameter
2008-08-11 15:34                   ` Frank Ch. Eigler
2008-08-11 15:34                     ` Frank Ch. Eigler
2008-08-11 15:48                     ` Christoph Lameter
2008-08-11 15:48                       ` Christoph Lameter
2008-08-11 15:54                       ` Steven Rostedt
2008-08-11 15:54                         ` Steven Rostedt
2008-08-11 15:57                       ` Frank Ch. Eigler
2008-08-11 15:57                         ` Frank Ch. Eigler
2008-08-11 18:29                   ` Mathieu Desnoyers
2008-08-11 18:29                     ` Mathieu Desnoyers
2008-08-12 15:25             ` Eduard - Gabriel Munteanu [this message]
2008-08-12 15:25               ` Eduard - Gabriel Munteanu
2008-08-12  6:46       ` [PATCH 3/5] kmemtrace: SLAB hooks Pekka Enberg
2008-08-12  6:46         ` Pekka Enberg
2008-08-12  6:46     ` [PATCH 2/5] kmemtrace: Additional documentation Pekka Enberg
2008-08-12  6:46       ` Pekka Enberg
2008-08-18 19:57     ` Randy Dunlap
2008-08-18 19:57       ` Randy Dunlap
2008-08-12  6:46   ` [PATCH 1/5] kmemtrace: Core implementation Pekka Enberg
2008-08-12  6:46     ` Pekka Enberg
  -- strict thread matches above, loose matches on Subject: below --
2008-08-19 17:43 [PATCH 1/5] Revert "kmemtrace: fix printk format warnings" Eduard - Gabriel Munteanu
2008-08-19 17:43 ` [PATCH 2/5] kmemtrace: Better alternative to " Eduard - Gabriel Munteanu
2008-08-19 17:43   ` [PATCH 3/5] SLUB: Replace __builtin_return_address(0) with _RET_IP_ Eduard - Gabriel Munteanu
2008-08-19 17:43     ` [PATCH 4/5] kmemtrace: SLUB hooks Eduard - Gabriel Munteanu
2008-08-19 17:43       ` Eduard - Gabriel Munteanu
2008-08-19 19:10       ` Pekka Enberg
2008-08-19 19:10         ` 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=20080812152548.GA5973@localhost \
    --to=eduard.munteanu@linux360.ro \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=rdunlap@xenotime.net \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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.