lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190821112113.GA2332@hirez.programming.kicks-ass.net>
Date:   Wed, 21 Aug 2019 13:21:13 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     Mark Rutland <mark.rutland@....com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Borislav Petkov <bp@...e.de>,
        Catalin Marinas <catalin.marinas@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Christoph Hellwig <hch@....de>, kan.liang@...el.com,
        Rik van Riel <riel@...riel.com>,
        Will Deacon <will@...nel.org>
Subject: Re: [PATCH 1/9] sched/core: add is_kthread() helper

On Mon, Aug 19, 2019 at 10:52:13AM +0200, Ingo Molnar wrote:
> * Mark Rutland <mark.rutland@....com> wrote:
> > On Wed, Aug 14, 2019 at 01:26:43PM +0200, Geert Uytterhoeven wrote:
> > > On Wed, Aug 14, 2019 at 12:43 PM Mark Rutland <mark.rutland@....com> wrote:

> > > > +static inline bool is_kthread(const struct task_struct *p)
> > > > +{
> > > > +       return !!(p->flags & PF_KTHREAD);
> > > 
> > > The !! is not really needed.
> > > Probably you followed is_idle_task() above (where it's also not needed).
> > 
> > Indeed! I'm aware of the implicit bool conversion, but kept that for
> > consistency.
> > 
> > Peter, Ingo, do you have a preference?
> 
> So the !! pattern is useful where the return value is an integer (i.e. 
> there's a risk of non-bool use) - but the return value is an explicit 
> bool here, so !! is IMO an entirely superfluous obfuscation.

Yeah, no real preference, for giggles, (_Bool) also seems to work.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ