From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757170AbdKOI14 (ORCPT ); Wed, 15 Nov 2017 03:27:56 -0500 Received: from mail-wr0-f171.google.com ([209.85.128.171]:46201 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751380AbdKOI1r (ORCPT ); Wed, 15 Nov 2017 03:27:47 -0500 X-Google-Smtp-Source: AGs4zMa8UsJzXnTypB7cg/tTVxx+qekHz4z24IUgW9MSwyxTLvbhbULXXEL0Gbwy6gmA1QNQ33zbBQ== Date: Wed, 15 Nov 2017 09:27:43 +0100 From: Ingo Molnar To: Matthew Wilcox Cc: luca abeni , Peter Zijlstra , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org Subject: Re: New sparse warnings from sched.h Message-ID: <20171115082743.6nvdz3yk6ln2ftc5@gmail.com> References: <20171114204135.GA23685@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171114204135.GA23685@bombadil.infradead.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Matthew Wilcox wrote: > > commit 799ba82de01e7543f6b2042e1a739f3a20255f23 > Author: luca abeni > Date: Thu Sep 7 12:09:31 2017 +0200 > > sched/deadline: Use C bitfields for the state flags > > Ask the compiler to use a single bit for storing true / false values, > instead of wasting the size of a whole int value. > Tested with gcc 5.4.0 on x86_64, and the compiler produces the expected > Assembly (similar to the Assembly code generated when explicitly accessing > the bits with bitmasks, "&" and "|"). > > produces four warnings from sparse for every file which includes sched.h: > > ./include/linux/sched.h:476:62: error: dubious one-bit signed bitfield > ./include/linux/sched.h:477:62: error: dubious one-bit signed bitfield > ./include/linux/sched.h:478:62: error: dubious one-bit signed bitfield > ./include/linux/sched.h:479:62: error: dubious one-bit signed bitfield > > This seems like the trivial fix (untested): > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index a5dc7c98b0a2..21991d668d35 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -473,10 +473,10 @@ struct sched_dl_entity { > * conditions between the inactive timer handler and the wakeup > * code. > */ > - int dl_throttled : 1; > - int dl_boosted : 1; > - int dl_yielded : 1; > - int dl_non_contending : 1; > + unsigned int dl_throttled : 1; > + unsigned int dl_boosted : 1; > + unsigned int dl_yielded : 1; > + unsigned int dl_non_contending : 1; > > /* > * Bandwidth enforcement timer. Each -deadline task has its Mind sending a proper patch with a SOB once it's tested? Thanks, Ingo