From: tip-bot for Franck Bui-Huu <fbuihuu@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, fbuihuu@gmail.com, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:perf/core] perf: Don't bother to init the hrtimer for no SW sampling counters
Date: Fri, 26 Nov 2010 15:04:34 GMT [thread overview]
Message-ID: <tip-5d508e820a23d9b6e8a149dfaa8ba5cbedf3d95c@git.kernel.org> (raw)
In-Reply-To: <1290525705-6265-3-git-send-email-fbuihuu@gmail.com>
Commit-ID: 5d508e820a23d9b6e8a149dfaa8ba5cbedf3d95c
Gitweb: http://git.kernel.org/tip/5d508e820a23d9b6e8a149dfaa8ba5cbedf3d95c
Author: Franck Bui-Huu <fbuihuu@gmail.com>
AuthorDate: Tue, 23 Nov 2010 16:21:45 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Nov 2010 15:14:55 +0100
perf: Don't bother to init the hrtimer for no SW sampling counters
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1290525705-6265-3-git-send-email-fbuihuu@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/perf_event.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 027c4d3..98c5549 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4917,24 +4917,26 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
static void perf_swevent_start_hrtimer(struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;
+ s64 period;
+
+ if (!is_sampling_event(event))
+ return;
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swevent_hrtimer;
- if (is_sampling_event(event)) {
- s64 period = local64_read(&hwc->period_left);
- if (period) {
- if (period < 0)
- period = 10000;
+ period = local64_read(&hwc->period_left);
+ if (period) {
+ if (period < 0)
+ period = 10000;
- local64_set(&hwc->period_left, 0);
- } else {
- period = max_t(u64, 10000, hwc->sample_period);
- }
- __hrtimer_start_range_ns(&hwc->hrtimer,
+ local64_set(&hwc->period_left, 0);
+ } else {
+ period = max_t(u64, 10000, hwc->sample_period);
+ }
+ __hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(period), 0,
HRTIMER_MODE_REL_PINNED, 0);
- }
}
static void perf_swevent_cancel_hrtimer(struct perf_event *event)
next prev parent reply other threads:[~2010-11-26 15:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 15:21 [PATCH 1/3] perf: introduce is_sampling_event() Franck Bui-Huu
2010-11-23 15:21 ` [PATCH 2/3] perf: Limit event refresh to sampling event Franck Bui-Huu
2010-11-23 15:21 ` [PATCH 3/3] perf: don't bother to init the hrtimer for no SW sampling counters Franck Bui-Huu
2010-11-26 15:04 ` tip-bot for Franck Bui-Huu [this message]
2010-11-26 15:04 ` [tip:perf/core] perf: Limit event refresh to sampling event tip-bot for Franck Bui-Huu
2010-11-26 15:03 ` [tip:perf/core] perf: Introduce is_sampling_event() tip-bot for Franck Bui-Huu
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=tip-5d508e820a23d9b6e8a149dfaa8ba5cbedf3d95c@git.kernel.org \
--to=fbuihuu@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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