From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
"eranian@gmail.com" <eranian@gmail.com>,
"Gary.Mohr@Bull.com" <Gary.Mohr@bull.com>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
"arjan@linux.intel.com" <arjan@linux.intel.com>,
"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
Paul Mackerras <paulus@samba.org>,
"David S. Miller" <davem@davemloft.net>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 1/4] perf: core, add group scheduling transactional APIs
Date: Thu, 22 Apr 2010 17:19:02 +0800 [thread overview]
Message-ID: <1271927943.3412.4.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <1271924699.1776.316.camel@laptop>
On Thu, 2010-04-22 at 16:24 +0800, Peter Zijlstra wrote:
> On Thu, 2010-04-22 at 15:51 +0800, Lin Ming wrote:
> > + if (pmu->commit_txn) {
> > + ret = pmu->commit_txn(pmu);
> > + if (!ret) {
> > + if (pmu->stop_txn)
> > + pmu->stop_txn(pmu);
> > +
> > + return 0;
> > + }
> > + }
>
> I think we can mandate that if one of the _txn methods is available,
> they all are, it would be weird otherwise.
>
How about below?
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index ffd2360..72ea25c 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -635,12 +635,16 @@ group_sched_in(struct perf_event *group_event,
{
struct perf_event *event, *partial_group = NULL;
const struct pmu *pmu = group_event->pmu;
+ bool txn = false;
int ret;
if (group_event->state == PERF_EVENT_STATE_OFF)
return 0;
if (pmu->start_txn)
+ txn = true;
+
+ if (txn)
pmu->start_txn(pmu);
if (event_sched_in(group_event, cpuctx, ctx))
@@ -656,18 +660,17 @@ group_sched_in(struct perf_event *group_event,
}
}
- if (pmu->commit_txn) {
+ if (txn) {
ret = pmu->commit_txn(pmu);
if (!ret) {
- if (pmu->stop_txn)
- pmu->stop_txn(pmu);
+ pmu->stop_txn(pmu);
return 0;
}
}
group_error:
- if (pmu->stop_txn)
+ if (txn)
pmu->stop_txn(pmu);
/*
next prev parent reply other threads:[~2010-04-22 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 7:51 [RFC][PATCH 1/4] perf: core, add group scheduling transactional APIs Lin Ming
2010-04-22 8:24 ` Peter Zijlstra
2010-04-22 9:19 ` Lin Ming [this message]
2010-04-22 17:31 ` Frederic Weisbecker
2010-04-23 2:08 ` Lin Ming
2010-04-23 2:12 ` 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=1271927943.3412.4.camel@minggr.sh.intel.com \
--to=ming.m.lin@intel.com \
--cc=Gary.Mohr@bull.com \
--cc=arjan@linux.intel.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=yanmin_zhang@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.