lkml.org 
[lkml]   [2019]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@arm.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@arm.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.

\
 
 \ /
  Last update: 2019-08-21 13:21    [W:0.082 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site