Re: [PATCH] sched: simplify is_cpu_allowed() code
From: Steven Rostedt
Date: Tue May 18 2021 - 09:48:18 EST
On Tue, 18 May 2021 15:27:46 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Tue, May 18, 2021 at 08:54:46PM +0800, Yejune Deng wrote:
> > Combine multiple if statements that return the same value.
>
> This patch is not a nop; You now deny cpu_dying() for everyone, while we
> explicitly allow it for kthread_is_per_cpu().
Right. The patch is flawed in many ways. You don't combine if statements
just because they return the same value, if you are messing with the order
of the checks.
if (A)
return false;
if (B)
return true;
if (C)
return false;
is not the same as
if (A || C)
return false
if (B)
return true;
Please don't do that.
-- Steve