From patchwork Mon Oct 9 10:26:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 149923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1768795vqo; Mon, 9 Oct 2023 03:26:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+NzgvSmvllq7fVMccczmrgI0uYt1a3Cmiy/dImXggEi6BTJ5y0UQW/t6vN6RJw8K7eQko X-Received: by 2002:a17:902:9a93:b0:1c8:8d9a:49d with SMTP id w19-20020a1709029a9300b001c88d9a049dmr6245588plp.47.1696847199839; Mon, 09 Oct 2023 03:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696847199; cv=none; d=google.com; s=arc-20160816; b=Z0jzleT8GH0KYQ+OtvufskKLw4X3sFn+N6R5mwhji8olNxW54G4Tba6UanuzdrmTuO Q4sQuQMJt2P9MJb452Fp244XKflB3wej72YWM2gchVXgL6snRPejAkskxQ7ACP81w+JZ 3afvHtCWtQ5eOBG5qI7/MwN0tFqPkcLO7x5b3x7dTQ181StDLKCW7DLCENTIaT3zwfxR FioefErt/aKobSpAI5Q69hNIfFc4+5F5qGmI/RqM5drUSrGt9o8Dc8DHQH4DRMFaHpvv hUmToXbg2E85cse6chJRQXScjGXVWFC7hl+VcrJZAM6nteUBqcpUg5C+qJXnQVcFSs3o NksQ== 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.s=2020e header.b=94D0NONb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id jw8-20020a170903278800b001c0953d0055si8802193plb.262.2023.10.09.03.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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.s=2020e header.b=94D0NONb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id A6A9E80569B3; Mon, 9 Oct 2023 03:26:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345655AbjJIK0R (ORCPT + 18 others); Mon, 9 Oct 2023 06:26:17 -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 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:26:35 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779273249594499099 X-GMAIL-MSGID: 1779273249594499099 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; /*