Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1199456 > unrolled thread

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

Started byyalin wang <yalin.wang2010@gmail.com>
First post2015-08-04 09:00 +0200
Last post2015-08-04 11:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface yalin wang <yalin.wang2010@gmail.com> - 2015-08-04 09:00 +0200
    Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-08-04 11:20 +0200

#1199456 — Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-08-04 09:00 +0200
SubjectRe: [PATCH -v2 6/8] jump_label: Add a new static_key interface
Message-ID<pTEmC-2QF-3@gated-at.bofh.it>
> On Jul 28, 2015, at 21:21, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> There are various problems and short-comings with the current
> static_key interface:
> 
> - static_key_{true,false}() read like a branch depending on the key
>   value, instead of the actual likely/unlikely branch depending on
>   init value.
> 
> - static_key_{true,false}() are, as stated above, tied to the
>   static_key init values STATIC_KEY_INIT_{TRUE,FALSE}.
> 
> - we're limited to the 2 (out of 4) possible options that compile to
>   a default NOP because that's what our arch_static_branch() assembly
>   emits.
> 
> So provide a new static_key interface:
> 
>  DEFINE_STATIC_KEY_TRUE(name);
>  DEFINE_STATIC_KEY_FALSE(name);
> 
> Which define a key of different types with an initial true/false
> value.
> 
> Then allow:
> 
>   static_branch_likely()
>   static_branch_unlikely()
> 
> to take a key of either type and emit the right instruction for the
> case.
> 
> This means adding a second arch_static_branch_jump() assembly helper
> which emits a JMP per default.
> 
> In order to determine the right instruction for the right state,
> encode the branch type in the LSB of jump_entry::key.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> 
is this means static_key_{true,false}() are deprecated ?
do you need mark static_key_{true,false}() as deprecated?
like this:
static __always_inline  __deprecated bool static_key_false(struct static_key *key)  ?
Thanks


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1199594

FromPeter Zijlstra <peterz@infradead.org>
Date2015-08-04 11:20 +0200
Message-ID<pTGy6-6co-11@gated-at.bofh.it>
In reply to#1199456
On Tue, Aug 04, 2015 at 02:50:32PM +0800, yalin wang wrote:
> is this means static_key_{true,false}() are deprecated ?

Yes.

> do you need mark static_key_{true,false}() as deprecated?
> like this:
> static __always_inline  __deprecated bool static_key_false(struct static_key *key)  ?

Not until I (or someone else) has made an effort to convert most (if not
all) current users of that interface.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web