Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753308AbbG2HTf (ORCPT ); Wed, 29 Jul 2015 03:19:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:50716 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753253AbbG2HTe (ORCPT ); Wed, 29 Jul 2015 03:19:34 -0400 Subject: Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface To: Peter Zijlstra , linux-kernel@vger.kernel.org, mingo@kernel.org References: <20150728132055.203176565@infradead.org> <20150728132313.164884020@infradead.org> Cc: 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 From: Vlastimil Babka Message-ID: <55B87E7A.2070509@suse.cz> Date: Wed, 29 Jul 2015 09:19:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <20150728132313.164884020@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1224 Lines: 36 On 07/28/2015 03:21 PM, Peter Zijlstra wrote: > +/* -------------------------------------------------------------------------- */ > + > +/* > + * Two type wrappers around static_key, such that we can use compile time > + * type differentiation to emit the right code. > + * > + * All the below code is macros in order to play type games. > + */ > + > +struct static_key_true { > + struct static_key key; > +}; > + > +struct static_key_false { > + struct static_key key; > +}; > + > +#define STATIC_KEY_TRUE_INIT (struct static_key_true) { .key = STATIC_KEY_INIT_TRUE, } > +#define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, } How would one define a static key that's e.g. expected to be mostly false, but with initial value of true, e.g. during boot? Is the following legal? Should there be an API wrapper as well? (struct static_key_false){ .key = STATIC_KEY_INIT_TRUE, } Otherwise the new API seems like a big improvement, 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/