From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751407AbdATHUL (ORCPT ); Fri, 20 Jan 2017 02:20:11 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36759 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbdATHUK (ORCPT ); Fri, 20 Jan 2017 02:20:10 -0500 Date: Fri, 20 Jan 2017 08:19:14 +0100 From: Ingo Molnar To: Jason Baron Cc: peterz@infradead.org, rostedt@goodmis.org, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH v2] jump_label: reduce the size of struct static_key Message-ID: <20170120071914.GA17003@gmail.com> References: <1483555303-13493-1-git-send-email-jbaron@akamai.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1483555303-13493-1-git-send-email-jbaron@akamai.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jason Baron wrote: > struct static_key { > atomic_t enabled; > +/* > + * bit 0 => 1 if key is initially true > + * 0 if initially false > + * bit 1 => 1 if points to struct static_key_mod > + * 0 if points to struct jump_entry > + */ > + union { > + unsigned long type; > + struct jump_entry *entries; > + struct static_key_mod *next; > + }; > + key->type = (unsigned long)jlm2 | static_key_type(key); > + key->type = (unsigned long)jlm | static_key_type(key); > + *prev = (struct static_key_mod *)((unsigned long)jlm->next | > + ((unsigned long)*prev & JUMP_TYPE_MASK)); > + key->type = (unsigned long)jlm->entries | > + static_key_type(key); I really hate these very ugly type conversions. Is there no cleaner way? For example the last line could sure be written as: key->entries = jlm->entries; key->type |= static_key_type(key); right? Thanks, Ingo