public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	Dipankar Sarma <dipankar@in.ibm.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] kmemtrace: Use tracepoints instead of markers.
Date: Sun, 4 Jan 2009 03:53:05 +0200	[thread overview]
Message-ID: <20090104015304.GA5198@localhost> (raw)
In-Reply-To: <20090102234254.GB29623@Krystal>

On Fri, Jan 02, 2009 at 06:42:54PM -0500, Mathieu Desnoyers wrote:
> * Eduard - Gabriel Munteanu (eduard.munteanu@linux360.ro) wrote:
> > > 
> > > Why do you need the enum kmemtrace_type_id type_id exactly ? Can you
> > > remove this parameter by adding more specific tracepoints ?
> > > 
> > 
> > Already done and moved that enum into the .c file. I've resubmitted the
> > whole thing (2 patches instead of 3). I'll provide an URL if you didn't get
> > those e-mails.
> > 
> 
> I got those, I just replied a little bit late. Thanks. I am not talking
> about moving the enum to a .c file here, I am simply asking why we don't
> use the already existing tracepoint naming rather than adding another
> level of event description in an event field.
>

Yes, already done (not just moved things around) in case I wasn't clear.

> > > > diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
> > > > index 7555ce9..e5a8b60 100644
> > > > --- a/include/linux/slab_def.h
> > > > +++ b/include/linux/slab_def.h
> > > > @@ -76,8 +76,9 @@ found:
> > > >  
> > > >  		ret = kmem_cache_alloc_notrace(cachep, flags);
> > > >  
> > > > -		kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret,
> > > > -				     size, slab_buffer_size(cachep), flags);
> > > > +		trace_kmemtrace_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret,
> > > > +				      size, slab_buffer_size(cachep),
> > > 
> > > You'll probably want to give "cachep" as parameter and do the
> > > slab_buffer_size(cachep) within the probe to remove unneeded code from
> > > the caller site.
> > > 
> > 
> > Hmm, I don't see how this could be an improvement.
> 
> Because whatever slab_buffer_size() does will be done on the fastpath of
> the instrumented code *even when instrumentation is disabled*, and this
> is something we need to avoid above all.
>

Oh, I see. You mean the case when kmemtrace is compiled in but not
enabled. For slab_buffer_size() this is no problem, but things like
(1 << order) do result in more computation being performed. I'll fix it.

Heh, I sometimes wish C was more like Haskell (lazy, outer evaluation) :P.

> > Slab code hackers are
> > supposed to see this and keep kmemtrace in line with slab internals.
> > Moving this away only makes things more awkward.
> > 
> 
> I am just saying this should be moved _into_ the kmemtrace probe. This
> code will have to be kept in sync with the kernel anyway.
>

I got that, but I'll try to keep any logic within slab code files. The
kmemtrace probe should call such a function to perform computation, so
developers won't ever need to look at mm/kmemtrace.c.

> > Besides, having a probe for each allocator and each function hardly
> > makes any sense.
> 
> Why ?
> 

Hmm, probably having some get_req_size() & get_alloc_size() defined for
all slab allocators might make more sense. Just like we do now to handle
different kmalloc() variants.

I really feel like having to change both slab code and kmemtrace code to
support some new allocator isn't the way to go. Ideally, one should only
insert calls to probes and provide that get_*_size() interface.

I'll see what can be done. But please comment if you think otherwise.

> > > Why do you need to pass -1 ? Can you have a more specific tracepoint
> > > instead ?
> > >
> > 
> > I've noticed probe functions tend to have really long names. -1 is just
> > very convenient, we could make it typo-proof by taking all negative values as
> > meaning "same node" in userspace, or clamp / warn about it in probes. Anyway,
> > I've seen SLOB does it in its inlines, e.g. kmem_cache_alloc() calls
> > kmem_cache_alloc_node(..., -1).
> > 
> 
> With all due respect, your argument is bogus because it does not take
> into account something far more important than "long function names",
> which is what the resulting assembly looks like, and how much overhead
> you add. Here, you are adding the overhead of 1 more parameter *per
> call* just to keep tracepoint names smaller. The same thing applies to
> your added enumeration. Is it me or it does not sound like a good
> tradeoff ? Remember that tracepoints in the memory allocator code are
> meant to be called *very* often.

Yes, it really is bogus, sorry. Will fix.


	Cheers,
	Eduard


  reply	other threads:[~2009-01-04  1:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-29  1:40 [PATCH 0/3] kmemtrace over tracepoints Eduard - Gabriel Munteanu
2008-12-29  1:40 ` [PATCH 1/3] RCU: Move some definitions to minimal headers Eduard - Gabriel Munteanu
2008-12-29  9:42   ` Pekka Enberg
2008-12-29 12:32     ` Ingo Molnar
2008-12-30  6:31     ` Paul E. McKenney
2008-12-29 14:56   ` Ingo Molnar
2008-12-29  1:40 ` [PATCH 2/3] tracepoints: Include only minimal RCU headers in linux/tracepoint.h Eduard - Gabriel Munteanu
2008-12-29  1:40 ` [PATCH 3/3] kmemtrace: Use tracepoints instead of markers Eduard - Gabriel Munteanu
2008-12-29  9:44   ` Pekka Enberg
2009-01-02 20:54     ` Mathieu Desnoyers
2009-01-02 23:03       ` Eduard - Gabriel Munteanu
2008-12-29 13:43   ` Pekka Enberg
2008-12-29 20:11     ` Eduard - Gabriel Munteanu
2009-01-02 20:53   ` Mathieu Desnoyers
2009-01-02 23:01     ` Eduard - Gabriel Munteanu
2009-01-02 23:42       ` Mathieu Desnoyers
2009-01-04  1:53         ` Eduard - Gabriel Munteanu [this message]
2009-01-04  4:10         ` Eduard - Gabriel Munteanu
2009-01-05 16:05           ` Mathieu Desnoyers
2009-01-05 17:57             ` Eduard - Gabriel Munteanu
2009-01-05 18:09               ` Mathieu Desnoyers
2008-12-29  9:41 ` [PATCH 0/3] kmemtrace over tracepoints 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=20090104015304.GA5198@localhost \
    --to=eduard.munteanu@linux360.ro \
    --cc=adobriyan@gmail.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    /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