All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: mingo@redhat.com, Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Phil_K97@gmx.de, groeck@chromium.org
Subject: Re: [PATCH] sched: Make sched_feat(x) boolean for !CONFIG_SCHED_DEBUG
Date: Tue, 23 Oct 2018 09:44:31 -0700	[thread overview]
Message-ID: <CAKwvOdnCSN4gdhOsa-27sSsEgfCOyddO971+SF1Hqjsvg-sYCQ@mail.gmail.com> (raw)
In-Reply-To: <20181023004116.77465-1-mka@chromium.org>

On Mon, Oct 22, 2018 at 5:41 PM Matthias Kaehlcke <mka@chromium.org> wrote:
>
> If scheduler debugging is disabled sched_feat() resolves to a constant
> value that can be non-boolean. clang raises a warning when it detects
> that a non-boolean constant is used as operand in logical expressions:
>
> kernel/sched/core.c:208:26: warning: use of logical '&&' with constant
>   operand [-Wconstant-logical-operand]
>     if ((irq_delta + steal) && sched_feat(NONTASK_CAPACITY))
>                             ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Convert the original expression to boolean by means of a double not
> operation.
>
> Reported-by: Philipp Klocke <Phil_K97@gmx.de>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>

Thanks for resending, but I'm tracking this patch in -next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=7e6f4c5d600c1c8e2a1d900e65cab319d9b6782e
I just cloned -next yesterday and looks like it's still there.

> ---
>  kernel/sched/sched.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 4a2e8cae63c4..b9387d35e261 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1393,7 +1393,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =
>         0;
>  #undef SCHED_FEAT
>
> -#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
> +#define sched_feat(x) (!!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)))
>
>  #endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */
>
> --
> 2.19.1.568.g152ad8e336-goog
>


-- 
Thanks,
~Nick Desaulniers

      reply	other threads:[~2018-10-23 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  0:41 [PATCH] sched: Make sched_feat(x) boolean for !CONFIG_SCHED_DEBUG Matthias Kaehlcke
2018-10-23 16:44 ` Nick Desaulniers [this message]

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=CAKwvOdnCSN4gdhOsa-27sSsEgfCOyddO971+SF1Hqjsvg-sYCQ@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=Phil_K97@gmx.de \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.