Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1690872
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | David Carrillo-Cisneros <davidcc@google.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set |
| Date | Wed, 19 Jul 2017 03:20:02 +0200 |
| Message-ID | <u4LOG-1ts-11@gated-at.bofh.it> (permalink) |
| References | <u4LOF-1ts-3@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WbHvWsqSNYwANm877b2GEPir407DlMP0IC01/TsQkaQ=; b=Jlr9TBgdnxyeslpSoAtbBRH1mVTtvZnbNuz6o7e00kUJUAVfaAq6C3l3sVio61byhJ 8Yl9zpt8vuzCmM2+RcXvo63CPxsNa7h7F+6LZByAxKV63XXWv+7e/bsc/n5rLw/HNTh1 6Vt0+F0YySSplcP7NzIrL24LnFxPU6sGH1BcVRCl8/0lqjc1syv3zSmwCL9gDANyZJPl +qruaDjxXy15vm9RnpljGwpztriCXZDuEGs2e8R1RtYtiFZfHN44DRboPbS+sgvmKHkD OCH453f778QAgyr/oRQcN0p6gh3sNPf/di9/5sT1kPePwV155ApGCFjlt4oKFvT9JzN9 S6mw== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WbHvWsqSNYwANm877b2GEPir407DlMP0IC01/TsQkaQ=; b=CP8K0YNXG5G1aCOOdAE8PGYhbC5Ue9MQBQk0qXLGbddTEiWMEt9NF4XDIs78HGlcms i0Wj/zgCimhfzoPnyQXhZ3MjZwIaGBo9jvCQ1Xok+F4w5r+eg3nH0MD67kw5x5lQ8bux 32P4N1BMbeK9dqAXeig05nlhve592k3QiHdJNPPAaGHhqbMmjShgziVJnFAdXz2+gEDk qduoZMGhSgCSRFqMUzTyixBinnEsMV5vnMsKjvT+2rJdsCfJI457RtPSi6DZMEnu/Ii3 +pm/tBVlRq6lLJG2oO50oKmgraf7DiGfCKcf04YgqC2X+d0WLBXsGnogL3+De85t6js7 tU6w== |
| X-Gm-Message-State | AIVw1119arktU3YnTFMuMm2dfcBAtVM3hV7WZwczSmUB63eyVZLNiiNG KrhgaXYYvt5K8nWdbholIQ== |
| X-Received | by 10.98.178.15 with SMTP id x15mr404576pfe.75.1500427141965; Tue, 18 Jul 2017 18:19:01 -0700 (PDT) |
| X-Mailer | git-send-email 2.14.0.rc0.284.gd933b75aa4-goog |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 43 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Kees Kook <keescook@chromium.org>, Sudeep Holla <Sudeep.Holla@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Wang Nan <wangnan0@huawei.com>, Elena Reshetova <elena.reshetova@intel.com>, Stephane Eranian <eranian@google.com>, Paul Turner <pjt@google.com>, David Carrillo-Cisneros <davidcc@google.com> |
| X-Original-Date | Tue, 18 Jul 2017 18:18:36 -0700 |
| X-Original-Message-ID | <20170719011839.99399-2-davidcc@google.com> |
| X-Original-References | <20170719011839.99399-1-davidcc@google.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1690872 |
Show key headers only | View raw
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