From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752896AbeDJMHq (ORCPT ); Tue, 10 Apr 2018 08:07:46 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:53617 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbeDJMHo (ORCPT ); Tue, 10 Apr 2018 08:07:44 -0400 Date: Tue, 10 Apr 2018 14:07:32 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra cc: yuankuiz@codeaurora.org, "Rafael J. Wysocki" , Linux PM , "Rafael J. Wysocki" , Frederic Weisbecker , Ingo Molnar , Len Brown , Linux Kernel Mailing List , linux-pm-owner@vger.kernel.org Subject: Re: [PATCH] time: tick-sched: use bool for tick_stopped In-Reply-To: <20180410112637.GD4082@hirez.programming.kicks-ass.net> Message-ID: References: <891d4f632fbff5052e11f2d0b6fac35d@codeaurora.org> <20180410112637.GD4082@hirez.programming.kicks-ass.net> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Apr 2018, Peter Zijlstra wrote: > On Tue, Apr 10, 2018 at 06:07:17PM +0800, yuankuiz@codeaurora.org wrote: > > > > > > @@ -48,8 +48,8 @@ struct tick_sched { > > > > > > unsigned long check_clocks; > > > > > > enum tick_nohz_mode nohz_mode; > > > > > > > > > > > > + bool tick_stopped : 1; > > > > > > unsigned int inidle : 1; > > > > > > - unsigned int tick_stopped : 1; > > > > > > unsigned int idle_active : 1; > > > > > > unsigned int do_timer_last : 1; > > > > > > unsigned int got_idle_tick : 1; > > > > > > > > > > I don't think this is a good idea at all. > > > > > > > > > > Please see https://lkml.org/lkml/2017/11/21/384 for example. > > > > [ZJ] Thanks for this sharing. Looks like, this patch fall into the > > > > case of > > > > "Maybe". > > > > > > This patch falls into the case 'pointless' because it adds extra storage > > [ZJ] 1 bit vs 1 bit. no more. > > Since its a different type, the bitfields will not be merged. Also I'm > surprised a bitfield with base-type _Bool is even allowed. > > > > for no benefit at all. > > [ZJ] tick_stopped is returned by the tick_nohz_tick_stopped() which is bool. > > The benefit is no any potiential type conversion could be minded. > > Do you have any actual evidence for that? Is there a compiler stupid > enough to generate code to convert a bool to a 1bit value? Sure, if you do: > > > > > > + bool tick_stopped : 1; which is stupidly allowed by the standard....