mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: luca abeni <luca.abeni@santannapisa.it>,
	Peter Zijlstra <peterz@infradead.org>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: New sparse warnings from sched.h
Date: Wed, 15 Nov 2017 06:54:45 -0800	[thread overview]
Message-ID: <20171115145445.GA319@bombadil.infradead.org> (raw)
In-Reply-To: <20171115082743.6nvdz3yk6ln2ftc5@gmail.com>

On Wed, Nov 15, 2017 at 09:27:43AM +0100, Ingo Molnar wrote:
> * Matthew Wilcox <willy@infradead.org> wrote:
> > commit 799ba82de01e7543f6b2042e1a739f3a20255f23
> > Author: luca abeni <luca.abeni@santannapisa.it>
> > 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?

I'd be more than happy to do that.  I have no idea what this code is,
what it's used for, or how to test it, so I'll have to rely on somebody
else to test it.

  reply	other threads:[~2017-11-15 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 20:41 Matthew Wilcox
2017-11-15  8:27 ` Ingo Molnar
2017-11-15 14:54   ` Matthew Wilcox [this message]
2017-11-15 15:10     ` Ingo Molnar
2017-11-15  8:36 ` luca abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115145445.GA319@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=bristot@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@santannapisa.it \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®