public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Zhaolei <zhaolei@cn.fujitsu.com>
Subject: Re: [RFC PATCH 1/2] tracing/stat: introduce new hashlist mode
Date: Mon, 01 Jun 2009 14:10:45 +0800	[thread overview]
Message-ID: <4A2370E5.6000407@cn.fujitsu.com> (raw)
In-Reply-To: <1243834679-19132-2-git-send-email-fweisbec@gmail.com>

Frederic Weisbecker wrote:
> Until now, the stat tracing was only able to gather the pointers
> to entries from a tracer, sort them and eventually pass these
> pointers to the tracer output handler.
> 
> It has two drawbacks:
> 
> - if the tracer concurrently releases a pointer, this one may be
>   dereference later in the output callback. There are ways to keep
>   track of these pointers but it ends up with extra code from the
>   tracers.
> 
> - the tracer has to handle its entries itself, through its own
>   hashlist, list or whatever.
> 

indeed

> This patch introduces a new mode for the stat tracers. Those can now
> ask the tracing stat Api to handle their entries, which includes the
> memory allocation, the access, the synchronization, the lookup, etc...
> 
> This is done through an internal hashlist that is built according
> to the number and size of entries provided by the tracer.
> 

But hashlist may not be suitable for all stat tracers?

> A tracer can choose between this new mode and the old one by using
> the HASH_NODES flag in struct tracer_stat.
> 

What's the advantages of the old mode towards this new mode?
I think it's better to move all existing stat tracers to
this new mode, and remove the old mode totally, if we want
this new mode.

> Instead of providing a pair of iterator callbacks, they just need
> to fill up the hlist_size and node_size fields.
> 
> Then using a unique id for each stat entries (usually a simple address
> to a traced thing), they can access to an entry using the two new pairs:
> 
> - get_stat_entry() which retrieve the entry and locks it against
>   concurrent updates
> - put_stat_entry() which unlocks the entry
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
>  kernel/trace/trace_stat.c |  329 ++++++++++++++++++++++++++++++++++++++++++++-
>  kernel/trace/trace_stat.h |   27 ++++-
>  2 files changed, 353 insertions(+), 3 deletions(-)

  reply	other threads:[~2009-06-01  6:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  5:37 [RFC PATCH 0/2] tracing/stat: stat entries self handling mode Frederic Weisbecker
2009-06-01  5:37 ` [RFC PATCH 1/2] tracing/stat: introduce new hashlist mode Frederic Weisbecker
2009-06-01  6:10   ` Li Zefan [this message]
2009-06-01 16:31     ` Frederic Weisbecker
2009-06-01  5:37 ` [RFC PATCH 2/2] tracing/stat: provide a sample example to use the hashlist based stat tracing Frederic Weisbecker

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=4A2370E5.6000407@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=zhaolei@cn.fujitsu.com \
    /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