From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63CA7C433B4 for ; Tue, 18 May 2021 13:48:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E20A610FA for ; Tue, 18 May 2021 13:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235264AbhERNte (ORCPT ); Tue, 18 May 2021 09:49:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:45650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245330AbhERNt1 (ORCPT ); Tue, 18 May 2021 09:49:27 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 92B1961185; Tue, 18 May 2021 13:48:08 +0000 (UTC) Date: Tue, 18 May 2021 09:48:07 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Yejune Deng , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org, Yejune Deng Subject: Re: [PATCH] sched: simplify is_cpu_allowed() code Message-ID: <20210518094807.57cb7fb7@gandalf.local.home> In-Reply-To: References: <1621342486-9643-1-git-send-email-yejunedeng@gmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 May 2021 15:27:46 +0200 Peter Zijlstra 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