Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp15960rdb; Mon, 14 Aug 2023 08:15:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEU11+848zhuIZ3voAUSFNM9uxGla7sja2FwrJgldwStcndcdYcJtnOkzYp0QCLstw+0VSy X-Received: by 2002:a17:902:dacd:b0:1bb:9506:d47c with SMTP id q13-20020a170902dacd00b001bb9506d47cmr9091959plx.19.1692026106248; Mon, 14 Aug 2023 08:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692026106; cv=none; d=google.com; s=arc-20160816; b=uYlcJP2OR0U/Qvh9zkYIqvat2JjXx0AJoTB/1cgKVUXlB18q351jNYGHR7iyHxWRyI mkEQHmZdh4rh8qsI071TMPen+daO54KMW8MggTCM28bIGkO2AlPsmTqDEH1vtBzZIfk3 /ui2kViFfwgC3wQGZFQ9HA2zB6BSNhyp5J7cKfBreTbR7I09/q/xTW+jD+7ScbhwoKq1 zeXc4RKOrwxAYSR2tEPwP2pui38HtdUFxPEeSQSYE61BpQeIzEwkUjqhYlRBmvkY/Zp4 D25HHbP+EmIKAe/w8Juiz7MiWS8m8B/Q7Nyw8+fDRsZZ/nE+fboCnJe/c2YwOmo8wq7f 1YrA== 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=TtHT+J68I3rRJzRfHqk10FJonfgbAJ03Mdzrif1b1mU=; fh=9BR/gsEAh/fSRAkzJ8jNxrANsAm8CeI+OnvVk4287ZY=; b=As/29tSrAxcLt730Lg+wgVgmdXtsGGW1+oCvWOPK+GqwLo4xkwGWp5aHKxK6yxb9ws UcMw6AD+gA+kyELakKKRhdcDPHb6N0pdAmjZisvLbUFgr4L+Bo3j3Xrbd1g86vsV7Hb0 zUuuMDd15lNQ3KD3Sgh9hfZ+fUsVpm6nxO48lP1vzG9DsNRbPF+qiqz+5LdhTK73uun7 RQsIk/zuqAVL1q/+RJhh6OJwWu0bivjweZvEQsR7SZvdm4Gk9EQU74xAGtwGWVPkIIl2 ep2JLMTSrSGk1osLxPZ2c7XW18n1Q9jrt+orX7MSjW8mC9vaDiS4nU1+746eYO0FEBWG 4zrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BltpUni2; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a170902db0a00b001b9d8ea026fsi8416999plx.485.2023.08.14.08.14.45; Mon, 14 Aug 2023 08:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BltpUni2; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232698AbjHNPId (ORCPT + 99 others); Mon, 14 Aug 2023 11:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232681AbjHNPIN (ORCPT ); Mon, 14 Aug 2023 11:08:13 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EDAA1701; Mon, 14 Aug 2023 08:08:09 -0700 (PDT) Date: Mon, 14 Aug 2023 15:08:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692025687; 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=TtHT+J68I3rRJzRfHqk10FJonfgbAJ03Mdzrif1b1mU=; b=BltpUni2c9NXtlxUmSn/rU5QLNmNCkCQ+95EzRLKLBxLZqXGR0nO+j/Vt89bgi/KAiAGeI ReCncP2ZJtf5FySBPFmEgwYibwR7QKpFtdnqXHWS31ViJY5Lz7Pu2mTU6XHW51VJ8K7R7k sAAMqxlvmxl/iHWyuMi+MFyWFHYub1rSUtHYp3OoXMA960h02wIMMbQoIAKbXHP+oaVtzT t8j9wJY97xobW0YcTO2909r13XrERwfZRYCOZiae/9TFiVpdufDSVUIqST2Dhe+CoID0jN zNcO+qGgkUXkHAEM6rR9pP5o+2I3p2tSIMWhQyWfAlJ10NGE8JUen7oc1gTaTg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692025687; 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=TtHT+J68I3rRJzRfHqk10FJonfgbAJ03Mdzrif1b1mU=; b=rhCZn1Q39812hLfPld+vRtxYLmkpjGjuEyVfm5EogcT5fYUR1sxSLgyJl/YfIFFcOivAR2 0N71+Jcf71J5h4DQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched: Simplify get_nohz_timer_target() Cc: "Peter Zijlstra (Intel)" , "Joel Fernandes (Google)" , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230801211811.828443100@infradead.org> References: <20230801211811.828443100@infradead.org> MIME-Version: 1.0 Message-ID: <169202568709.27769.1200732913266854235.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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 7537b90c0036759e0b1b43dfbc6224dc5e900b13 Gitweb: https://git.kernel.org/tip/7537b90c0036759e0b1b43dfbc6224dc5e900b13 Author: Peter Zijlstra AuthorDate: Tue, 01 Aug 2023 22:41:22 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 14 Aug 2023 17:01:24 +02:00 sched: Simplify get_nohz_timer_target() Use guards to reduce gotos and simplify control flow. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Joel Fernandes (Google) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20230801211811.828443100@infradead.org --- kernel/sched/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a97eab3..6cda296 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1097,25 +1097,22 @@ int get_nohz_timer_target(void) hk_mask = housekeeping_cpumask(HK_TYPE_TIMER); - rcu_read_lock(); + guard(rcu)(); + for_each_domain(cpu, sd) { for_each_cpu_and(i, sched_domain_span(sd), hk_mask) { if (cpu == i) continue; - if (!idle_cpu(i)) { - cpu = i; - goto unlock; - } + if (!idle_cpu(i)) + return i; } } if (default_cpu == -1) default_cpu = housekeeping_any_cpu(HK_TYPE_TIMER); - cpu = default_cpu; -unlock: - rcu_read_unlock(); - return cpu; + + return default_cpu; } /*