From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>, Jason Baron <jbaron@redhat.com>,
linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
Mike Galbraith <efault@gmx.de>
Subject: Re: [RFC][PATCH 5/7] jump_label: atomic_t interface
Date: Fri, 15 Oct 2010 16:01:39 +0200 [thread overview]
Message-ID: <20101015140137.GC5334@nowhere> (raw)
In-Reply-To: <20101014203625.501657727@chello.nl>
On Thu, Oct 14, 2010 at 10:34:09PM +0200, Peter Zijlstra wrote:
> Add an interface to allow usage of jump_labels with atomic counters
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
> include/linux/jump_label_ref.h | 44 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> Index: linux-2.6/include/linux/jump_label_ref.h
> ===================================================================
> --- /dev/null
> +++ linux-2.6/include/linux/jump_label_ref.h
> @@ -0,0 +1,44 @@
> +#ifndef _LINUX_JUMP_LABEL_REF_H
> +#define _LINUX_JUMP_LABEL_REF_H
> +
> +#include <linux/jump_label.h>
> +#include <asm/atomic.h>
> +
> +#ifdef HAVE_JUMP_LABEL
> +
> +static inline void jump_label_inc(atomic_t *key)
> +{
> + if (atomic_add_return(1, key) == 1)
> + jump_label_enable(key);
> +}
> +
> +static inline void jump_label_dec(atomic_t *key)
> +{
> + if (atomic_dec_and_test(key))
> + jump_label_disable(key);
> +}
Nice. I was trying to find a more self-explanatory name,
like jump_label_get/put or jump_label_inc_enable/jump_label_dec_disable.
But in fact the current name looks good eventually.
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> +#else /* !HAVE_JUMP_LABEL */
> +
> +static inline void jump_label_inc(atomic_t *key)
> +{
> + atomic_inc(key);
> +}
> +
> +static inline void jump_label_dec(atomic_t *key)
> +{
> + atomic_dec(key);
> +}
> +
> +#undef JUMP_LABEL
> +#define JUMP_LABEL(key, label) \
> +do { \
> + if (unlikely(__builtin_choose_expr( \
> + __builtin_types_compatible_p(typeof(key), atomic_t *), \
> + atomic_read((atomic_t *)(key)), *(key)))) \
> + goto label; \
> +} while (0)
> +
> +#endif /* HAVE_JUMP_LABEL */
> +
> +#endif /* _LINUX_JUMP_LABEL_REF_H */
>
>
next prev parent reply other threads:[~2010-10-15 15:02 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 20:34 [RFC][PATCH 0/7] perf and jump_label bits Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 1/7] perf: Fix task refcount issues Peter Zijlstra
2010-10-15 18:14 ` Frederic Weisbecker
2010-10-15 20:02 ` Matt Helsley
2010-10-18 19:19 ` [tip:perf/core] perf: Fix task refcount bugs tip-bot for Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 2/7] perf: Find task before event alloc Peter Zijlstra
2010-10-18 19:20 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 3/7] perf, hw_breakpoint: Fix crash in hw_breakpoint creation Peter Zijlstra
2010-10-15 13:47 ` Frederic Weisbecker
2010-10-15 13:52 ` Peter Zijlstra
2010-10-18 19:20 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 4/7] jump_label: More consitent naming Peter Zijlstra
2010-10-18 19:21 ` [tip:perf/core] jump_label: Use more consistent naming tip-bot for Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 5/7] jump_label: atomic_t interface Peter Zijlstra
2010-10-15 14:01 ` Frederic Weisbecker [this message]
2010-10-18 19:21 ` [tip:perf/core] jump_label: Add " tip-bot for Peter Zijlstra
2010-10-18 19:21 ` [tip:perf/core] perf: Use jump_labels to optimize the scheduler hooks tip-bot for Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 6/7] perf: use jump_label " Peter Zijlstra
2010-10-15 13:59 ` Frederic Weisbecker
2010-10-17 9:52 ` Peter Zijlstra
2010-10-17 10:16 ` Peter Zijlstra
2010-10-14 20:34 ` [RFC][PATCH 7/7] perf: Optimize sw events Peter Zijlstra
2010-10-15 9:14 ` Peter Zijlstra
2010-10-15 14:18 ` Jason Baron
2010-10-15 14:57 ` Peter Zijlstra
2010-10-15 15:02 ` Jason Baron
2010-10-15 19:32 ` Steven Rostedt
2010-10-15 19:54 ` Peter Zijlstra
2010-10-16 6:27 ` Ingo Molnar
2010-10-15 14:04 ` Frederic Weisbecker
2010-10-15 14:08 ` Peter Zijlstra
2010-10-15 14:11 ` 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=20101015140137.GC5334@nowhere \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--cc=efault@gmx.de \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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