From: highguy@gmail.com
To: mingo@elte.hu, linux-kernel@vger.kernel.org
Cc: torvalds@linux-foundation.org, efault@gmx.de,
a.p.zijlstra@chello.nl, andrea@suse.de, tglx@linutronix.de,
akpm@linux-foundation.org, peterz@infradead.org,
Stijn Devriendt <HIGHGuY@gmail.com>
Subject: [PATCH 5/6] Allow decrementing counters
Date: Sun, 7 Feb 2010 12:30:58 +0100 [thread overview]
Message-ID: <1265542259-5596-6-git-send-email-HIGHGuY@gmail.com> (raw)
In-Reply-To: <1265542259-5596-5-git-send-email-HIGHGuY@gmail.com>
From: Stijn Devriendt <HIGHGuY@gmail.com>
---
include/linux/perf_event.h | 6 +++---
kernel/perf_event.c | 16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 4f7d318..084f322 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -515,7 +515,7 @@ struct pmu {
void (*disable) (struct perf_event *event);
void (*update) (struct perf_event *event);
void (*unthrottle) (struct perf_event *event);
- u64 (*add) (struct perf_event *event, u64 count);
+ u64 (*add) (struct perf_event *event, s64 count);
int (*reset) (struct perf_event *event);
void (*wakeup) (struct perf_event *event);
u64 (*read) (struct perf_event *event);
@@ -826,10 +826,10 @@ static inline int is_software_event(struct perf_event *event)
extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
-extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
+extern void __perf_sw_event(u32, s64, int, struct pt_regs *, u64);
static inline void
-perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
+perf_sw_event(u32 event_id, s64 nr, int nmi, struct pt_regs *regs, u64 addr)
{
if (atomic_read(&perf_swevent_enabled[event_id]))
__perf_sw_event(event_id, nr, nmi, regs, addr);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 724aafd..08885d0 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3770,12 +3770,12 @@ static void perf_event_wakeup_one(struct perf_event *event)
wake_up(&event->waitq);
}
-static u64 __perf_event_add(struct perf_event *event, u64 count)
+static u64 __perf_event_add(struct perf_event *event, s64 count)
{
return atomic64_add_return(count, &event->count);
}
-static u64 perf_event_add(struct perf_event *event, u64 count)
+static u64 perf_event_add(struct perf_event *event, s64 count)
{
if (event->pmu->add)
return event->pmu->add(event, count);
@@ -3856,7 +3856,7 @@ static void perf_swevent_unthrottle(struct perf_event *event)
*/
}
-static void perf_swevent_add(struct perf_event *event, u64 nr,
+static void perf_swevent_add(struct perf_event *event, s64 nr,
int nmi, struct perf_sample_data *data,
struct pt_regs *regs)
{
@@ -3870,10 +3870,10 @@ static void perf_swevent_add(struct perf_event *event, u64 nr,
if (!hwc->sample_period)
return;
- if (nr == 1 && hwc->sample_period == 1 && !event->attr.freq)
+ if (abs(nr) == 1 && hwc->sample_period == 1 && !event->attr.freq)
return perf_swevent_overflow(event, 1, nmi, data, regs);
- if (atomic64_add_negative(nr, &hwc->period_left))
+ if (atomic64_add_negative(abs(nr), &hwc->period_left))
return;
perf_swevent_overflow(event, 0, nmi, data, regs);
@@ -3956,7 +3956,7 @@ static int perf_swevent_match(struct perf_event *event,
static void perf_swevent_ctx_event(struct perf_event_context *ctx,
enum perf_type_id type,
- u32 event_id, u64 nr, int nmi,
+ u32 event_id, s64 nr, int nmi,
struct perf_sample_data *data,
struct pt_regs *regs)
{
@@ -4004,7 +4004,7 @@ void perf_swevent_put_recursion_context(int rctx)
EXPORT_SYMBOL_GPL(perf_swevent_put_recursion_context);
static void do_perf_sw_event(enum perf_type_id type, u32 event_id,
- u64 nr, int nmi,
+ s64 nr, int nmi,
struct perf_sample_data *data,
struct pt_regs *regs)
{
@@ -4025,7 +4025,7 @@ static void do_perf_sw_event(enum perf_type_id type, u32 event_id,
rcu_read_unlock();
}
-void __perf_sw_event(u32 event_id, u64 nr, int nmi,
+void __perf_sw_event(u32 event_id, s64 nr, int nmi,
struct pt_regs *regs, u64 addr)
{
struct perf_sample_data data;
--
1.6.6
next prev parent reply other threads:[~2010-02-07 11:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-07 11:30 [RFC][PATCH] PERF_COUNT_SW_RUNNABLE_TASKS: measure and act upon parallellism highguy
2010-02-07 11:30 ` [PATCH 1/6] Move poll into perf_event and allow for wakeups when fd has not been mmap'd. This is useful when using read() to read out the current counter value highguy
2010-02-07 11:30 ` [PATCH 2/6] Allow min/max thresholds for wakeups highguy
2010-02-07 11:30 ` [PATCH 3/6] Add handlers for adding counter events, reading counter events, counter resets, wakeups. Renamed old read handler to update highguy
2010-02-07 11:30 ` [PATCH 4/6] Fix HW breakpoint handlers highguy
2010-02-07 11:30 ` highguy [this message]
2010-02-07 11:30 ` [PATCH 6/6] Add PERF_COUNT_SW_RUNNABLE_TASKS highguy
2010-02-08 10:00 ` [RFC][PATCH] PERF_COUNT_SW_RUNNABLE_TASKS: measure and act upon parallellism Peter Zijlstra
2010-02-08 11:52 ` Stijn Devriendt
2010-02-08 11:59 ` Peter Zijlstra
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=1265542259-5596-6-git-send-email-HIGHGuY@gmail.com \
--to=highguy@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andrea@suse.de \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
Powered by JetHome