Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1690872
| From | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set |
| Date | 2017-07-19 03:20 +0200 |
| Message-ID | <u4LOG-1ts-11@gated-at.bofh.it> (permalink) |
| References | <u4LOF-1ts-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Atomic reference counters were replaced by refcount_t in
commit 79c5fe6db8c7 ("perf/core: Fix error handling in perf_event_alloc()")
In util/cgroup.c atomic_inc was replaced by refcount_inc, but the latter
is not mean to initiliaze refcounts with zero value. Add a path
to initialize cgrp->refcnt == 0 using refcount_set.
Before this patch:
$ perf stat -e cycles -C 0 -G /
perf_before: /usr/local/.../tools/include/linux/refcount.h:108: refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted (core dumped)
After this patch:
$ perf stat -e cycles -C 0 -G /
Performance counter stats for 'CPU(s) 0':
17,516,664 cycles /
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Change-Id: I8f00f61aaecce876e7df448bd7f850b20db13ef1
---
tools/perf/util/cgroup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 03347748f3fa..7bbc19b3caf3 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -133,7 +133,10 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
return -1;
found:
- refcount_inc(&cgrp->refcnt);
+ if (refcount_read(&cgrp->refcnt) == 0)
+ refcount_set(&cgrp->refcnt, 1);
+ else
+ refcount_inc(&cgrp->refcnt);
counter->cgrp = cgrp;
return 0;
}
--
2.13.2.932.g7449e964c-goog
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] Resubmitted forgotten patches David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[PATCH 4/4] tools: perf: Fix linker error when libelf config is disabled David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[tip:perf/core] perf jvmti: Fix linker error when libelf config is disabled tip-bot for Sudeep Holla <tipbot@zytor.com> - 2017-07-26 19:30 +0200
[PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
Re: [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 19:00 +0200
[PATCH 2/4] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[tip:perf/core] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-07-26 19:30 +0200
Re: [PATCH 0/4] Resubmitted forgotten patches Jiri Olsa <jolsa@redhat.com> - 2017-07-19 10:50 +0200
Re: [PATCH 0/4] Resubmitted forgotten patches Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 19:10 +0200
csiph-web