Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754518AbbHDGuo (ORCPT ); Tue, 4 Aug 2015 02:50:44 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35948 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753953AbbHDGun convert rfc822-to-8bit (ORCPT ); Tue, 4 Aug 2015 02:50:43 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface From: yalin wang In-Reply-To: <20150728132313.164884020@infradead.org> Date: Tue, 4 Aug 2015 14:50:32 +0800 Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jasonbaron0@gmail.com, bp@alien8.de, luto@amacapital.net, tglx@linutronix.de, rostedt@goodmis.org, will.deacon@arm.com, liuj97@gmail.com, rabin@rab.in, ralf@linux-mips.org, ddaney@caviumnetworks.com, benh@kernel.crashing.org, michael@ellerman.id.au, heiko.carstens@de.ibm.com, davem@davemloft.net, vbabka@suse.cz Content-Transfer-Encoding: 8BIT Message-Id: <23C8FA53-2D16-4A77-BC2A-98CE32AE317C@gmail.com> References: <20150728132055.203176565@infradead.org> <20150728132313.164884020@infradead.org> To: Peter Zijlstra X-Mailer: Apple Mail (2.2098) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1729 Lines: 54 > On Jul 28, 2015, at 21:21, Peter Zijlstra 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) > --- > 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/