Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1798729rdb; Mon, 9 Oct 2023 03:26:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlHodkv3qKXeEUU9VTJ6pNXrsx60t4wzdfaJxIwbxo4/V4ZYfz741wK8qmUtEOSQKktd8s X-Received: by 2002:a05:6a00:3a08:b0:690:cae9:714d with SMTP id fj8-20020a056a003a0800b00690cae9714dmr13783824pfb.13.1696847197853; Mon, 09 Oct 2023 03:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696847197; cv=none; d=google.com; s=arc-20160816; b=MZqPm1nENs6cVwz6gv8zPrjEROImzWfnn6P411SsYW8MI9OnI+FuPKQOThJWaj0RIi /7QE8CnrH+YtevGct/9zkn5TOlSXClbnfVnDpCr2+FnP7qvAMtft+n/cPkQuM4VhFZhm yt0OuMl7+9PxcXtObdc+hgJYTNKCjcOlcpakqNjM0Idhev2iIE1qvGEH80jLnwD9PQ1Y m/JEeFwGT4peV/f5rjvsqjdqRl89rVW/uolkazIYTNcPv9UgZMT8j6mXvmQs4N9mBHDJ uo/2zAzWOl1Nyz7DQN0qB6VrqCo2271LrdH1iJPNwEx3Q7AFhpeI3mc4Vn2txJ1U00cE sTRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=7S8iBamwoqMF5Q9aR2B8Rdv3kLt9b/VFv73v1vNci9o=; fh=98PO9cUXyB5KzM7iQQrkqvLNVc4QFHsO4opbmVeOgeo=; b=B2N57vpI85PUG9eNMm/ZR5u8mn4LXW2ntCqsoperUkcDxaDxePr3zI7l6XrtrBcYKj fcpIkScsFIPrjir/QkFks4oBowWcrOomXp7uWnzUDtD7oEW2AiuixGfOOcElAITmWW18 CaZ3H8UBJMsHaj/g1t8cF93a/8w0M6aWeJGPiFQs+G66NCVIVdExnjtthYxzmAP1ZKjg m2UJKtAAm2gCmNA+s0OBZEmR2v7AjBFp2BkhhDY2sXZZGPZJArEMAL30+SJLrYiV79KA ng/WO/MWaeTlGINaFk5kMhmqObTB8mpa2ogtcqh+CnAINh7vqe7ljfzjgOydd6c2uOHZ Y/0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vg6xIS9y; dkim=neutral (no key) header.i=@linutronix.de header.b=94D0NONb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o2-20020a634102000000b00573ed0023e1si9281749pga.333.2023.10.09.03.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vg6xIS9y; dkim=neutral (no key) header.i=@linutronix.de header.b=94D0NONb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3BC858058B52; Mon, 9 Oct 2023 03:26:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345616AbjJIK0Q (ORCPT + 99 others); Mon, 9 Oct 2023 06:26:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbjJIK0P (ORCPT ); Mon, 9 Oct 2023 06:26:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BCCD99; Mon, 9 Oct 2023 03:26:13 -0700 (PDT) Date: Mon, 09 Oct 2023 10:26:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696847171; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7S8iBamwoqMF5Q9aR2B8Rdv3kLt9b/VFv73v1vNci9o=; b=Vg6xIS9yv82xscmF6w5RYwOXqwAIbTPmzAo4E7w+qqGtzRPqhUvM+vAX1B6kYWXjpZtoJr yHqaBeSuGct2OmbZWh7nSigdC7r3/CXokEVrGRage4MMON3zP1caNH1pnuCH0B9okZIfQ/ lAw5dH977gtCeGi/OlrBP06tGtvQ3LhAUJfq8KY2NhVJespYQ2AA5OUyl7cM8HNvbPav4Q SUxKbUzuN9xmqVqFhv9VssRoP+Yz5UCL/Y6c1vSSRBrohfpq3VY8HxD+KOsRWW5lGfaV2P QreBUZrjQMW3AsiPH+RzNKRWJO7GwEtpLGRnJEtKTpHjv3wcdJcyVwSjJhG/NA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696847171; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7S8iBamwoqMF5Q9aR2B8Rdv3kLt9b/VFv73v1vNci9o=; b=94D0NONb2e5OPtYjYweONyCe++FkjZpdwhVhTt/kMqpINJZyu5YZQKch5w3DaXD92l+3Ld IrKamuUl6dhheZDQ== From: "tip-bot2 for Ingo Molnar" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/nohz: Remove unnecessarily complex error handling pattern from find_new_ilb() Cc: Ingo Molnar , "Joel Fernandes (Google)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231006102518.2452758-4-mingo@kernel.org> References: <20231006102518.2452758-4-mingo@kernel.org> MIME-Version: 1.0 Message-ID: <169684717032.3135.17626767741431018350.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:26:35 -0700 (PDT) X-Spam-Level: ** The following commit has been merged into the sched/core branch of tip: Commit-ID: f4bb5705114530cd775a5a649b666755b3efe7aa Gitweb: https://git.kernel.org/tip/f4bb5705114530cd775a5a649b666755b3efe7aa Author: Ingo Molnar AuthorDate: Fri, 06 Oct 2023 12:25:18 +02:00 Committer: Ingo Molnar CommitterDate: Mon, 09 Oct 2023 12:21:23 +02:00 sched/nohz: Remove unnecessarily complex error handling pattern from find_new_ilb() find_new_ilb() returns nr_cpu_ids on failure - which is the usual cpumask bitops return pattern, but is weird & unnecessary in this context: not only is it a global variable, it it is a +1 out of bounds CPU index and also has different signedness ... Its only user, kick_ilb(), then checks the return against nr_cpu_ids to decide to return. There's no other use. So instead of this, use a standard -1 return on failure to find an idle CPU, as the argument is signed already. Signed-off-by: Ingo Molnar Reviewed-by: Joel Fernandes (Google) Link: https://lore.kernel.org/r/20231006102518.2452758-4-mingo@kernel.org --- kernel/sched/fair.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f82b301..19bb4ac 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11528,7 +11528,7 @@ static inline int find_new_ilb(void) return ilb_cpu; } - return nr_cpu_ids; + return -1; } /* @@ -11549,8 +11549,7 @@ static void kick_ilb(unsigned int flags) nohz.next_balance = jiffies+1; ilb_cpu = find_new_ilb(); - - if (ilb_cpu >= nr_cpu_ids) + if (ilb_cpu < 0) return; /*