From: David Ahern <dsahern@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Don Zickus <dzickus@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 3/5] perf tools: Reference count map_groups objects
Date: Mon, 14 Apr 2014 11:22:02 -0600 [thread overview]
Message-ID: <534C193A.2000806@gmail.com> (raw)
In-Reply-To: <1397490723-1992-4-git-send-email-jolsa@redhat.com>
On 4/14/14, 9:52 AM, Jiri Olsa wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> We will share it among threads in the same process.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Don Zickus <dzickus@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Stephane Eranian <eranian@google.com>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
> tools/perf/util/map.c | 7 +++++++
> tools/perf/util/map.h | 9 +++++++++
> tools/perf/util/thread.c | 2 +-
> 3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
> index ae4c5e1..ba5f5c0c 100644
> --- a/tools/perf/util/map.c
> +++ b/tools/perf/util/map.c
> @@ -323,6 +323,7 @@ void map_groups__init(struct map_groups *mg)
> INIT_LIST_HEAD(&mg->removed_maps[i]);
> }
> mg->machine = NULL;
> + mg->refcnt = 1;
> }
>
> static void maps__delete(struct rb_root *maps)
> @@ -374,6 +375,12 @@ void map_groups__delete(struct map_groups *mg)
> free(mg);
> }
>
> +void map_groups__put(struct map_groups *mg)
> +{
> + if (--mg->refcnt == 0)
> + map_groups__delete(mg);
> +}
> +
> void map_groups__flush(struct map_groups *mg)
> {
> int type;
> diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
> index 1073e2d..d6445b2 100644
> --- a/tools/perf/util/map.h
> +++ b/tools/perf/util/map.h
> @@ -59,11 +59,20 @@ struct map_groups {
> struct rb_root maps[MAP__NR_TYPES];
> struct list_head removed_maps[MAP__NR_TYPES];
> struct machine *machine;
> + int refcnt;
> };
atomic for refcnt? This is part of a libperf; would be good to support
multithreaded users.
David
next prev parent reply other threads:[~2014-04-14 17:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 15:51 [PATCHv2 0/5] perf tools: Share map groups within process Jiri Olsa
2014-04-14 15:51 ` [PATCH 1/5] perf tests: Add thread maps lookup automated tests Jiri Olsa
2014-04-29 6:46 ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-04-14 15:52 ` [PATCH 2/5] perf tools: Allocate thread map_groups's dynamically Jiri Olsa
2014-04-29 6:46 ` [tip:perf/core] perf tools: Allocate thread map_groups' s dynamically tip-bot for Arnaldo Carvalho de Melo
2014-04-14 15:52 ` [PATCH 3/5] perf tools: Reference count map_groups objects Jiri Olsa
2014-04-14 17:22 ` David Ahern [this message]
2014-04-15 9:56 ` Jiri Olsa
2014-04-15 18:17 ` David Ahern
2014-04-23 16:31 ` Jiri Olsa
2014-04-23 16:45 ` David Ahern
2014-04-29 6:46 ` [tip:perf/core] " tip-bot for Arnaldo Carvalho de Melo
2014-04-14 15:52 ` [PATCH 4/5] perf tools: Share map_groups among threads of the same group Jiri Olsa
2014-04-29 6:46 ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-04-14 15:52 ` [PATCH 5/5] perf tests: Add map groups sharing with thread object test Jiri Olsa
2014-04-24 14:29 ` Namhyung Kim
2014-04-29 6:46 ` [tip:perf/core] " tip-bot for Jiri Olsa
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=534C193A.2000806@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dzickus@redhat.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.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).