From: Thomas Gleixner <tglx@linutronix.de>
To: Jiri Kosina <jikos@kernel.org>
Cc: luca abeni <luca.abeni@santannapisa.it>,
Peter Zijlstra <peterz@infradead.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Juri Lelli <juri.lelli@arm.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Mike Galbraith <efault@gmx.de>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/deadline: Use bools for the state flags
Date: Tue, 21 Nov 2017 11:52:37 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1711211151200.1782@nanos> (raw)
In-Reply-To: <nycvar.YFH.7.76.1711211142300.11505@cbobk.fhfr.pm>
On Tue, 21 Nov 2017, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
>
> Commit
>
> 799ba82de01e ("sched/deadline: Use C bitfields for the state flags")
>
> converted state flags into one-bit signed int. Signed one-bit type can be
> either 0 or -1, which is going to cause a problem once 1 is assigned to it
> and then the value later tested against 1.
>
> The current code is okay, as all the checks are (non-)zero check, but I
> believe that we'd rather be safe than sorry here; remove the fragility by
> converting the state flags to bool.
>
> This also silences annoying sparse complaints about this very issue when
> compiling any code that includes sched.h.
What's wrong with making these bitfields 'unsigned int' ?
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index a5dc7c98b0a2..b19fa1b96726 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;
> + bool dl_throttled;
> + bool dl_boosted;
> + bool dl_yielded;
> + bool dl_non_contending;
Thanks,
tglx
next prev parent reply other threads:[~2017-11-21 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 10:44 Jiri Kosina
2017-11-21 10:52 ` Thomas Gleixner [this message]
2017-11-21 11:43 ` Jiri Kosina
2017-11-21 12:00 ` [PATCH v2] sched/deadline: Use unsigned type " Jiri Kosina
2017-11-21 16:22 ` Ingo Molnar
2017-11-21 12:56 ` [PATCH] sched/deadline: Use bools " Steven Rostedt
2017-11-21 15:53 ` Linus Torvalds
2017-11-21 10:56 ` Luca Abeni
2017-11-21 13:06 ` Peter Zijlstra
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=alpine.DEB.2.20.1711211151200.1782@nanos \
--to=tglx@linutronix.de \
--cc=bristot@redhat.com \
--cc=efault@gmx.de \
--cc=jikos@kernel.org \
--cc=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mathieu.poirier@linaro.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.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®