Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3273032iog; Mon, 20 Jun 2022 15:52:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tBllK+lJuJdgUvLUX4c2fOVdPV8Y8luoyjvo/C5FSf2QjGPsR/K9WCAC/a5+awFN7hmjvi X-Received: by 2002:a05:6402:1249:b0:435:5e0c:20ac with SMTP id l9-20020a056402124900b004355e0c20acmr23603703edw.100.1655765542125; Mon, 20 Jun 2022 15:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655765542; cv=none; d=google.com; s=arc-20160816; b=ku4FcUL76apXBz1vsSi3A851cLeWz2brbAOfuZLTU4y3xZ7EXdOnSn7Xqoy0tzRx3O 5zF2iDE3SFgWwFcq1RmcfQmgmJTwVvKDJzocDXwS6Yv2sv1sizhFYS1JPGZuqfNXkD+I E1SbsQn3UGw1BdHRlYrmvGHTAGpDWFf/fhyOtzhbhJYel0TAMuCdMNa2U3NPcL9Shey+ 7ODZj04AGbWMdaf2w4pOb2zP5PvRZnLr6CoHZZCXwdfjO20RijpVin+CubP48K7MWfIQ 67x2PkaSzlLXqZYBTA4vMfxPva9bBENHpHgNvI9Xsjx3NDebNnQR74gUVe6GMETiWcoo tqIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T4s8Kq/SwRSnpdnII49DAOsgX8uqgGFQ6Zchda8U7RM=; b=pJRTpNkIdecj8tnghggs1DrTDRMTGZ1d292PjthrhBcR4Ib7EWzd6rRV/g1RoekyY0 Ju4TeKL1ufobRycdH98R/WhjX6LDDO1R4p/Hcm9i0JlyUiO/0o0/StelusvWU40MFa79 3ph11ZEHW4v3gV6w0U4rvt0Gn6PTejJenem4T1rOpsz0/GyFKvF4UZ904cGQ3f+zS67O JBgD8f/bjpNSarSY1+SDFaspxxXTu8O5LwES6IsirTBuXOAHKzKGyx3DPPwhme7z2IFL l/MNqo8gI6Xy1XMth+mwxUWpqdLknhegYIBoCK9rLBvnQeZiKOLdNHdQ9uU2TTuWpeLJ xGcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fXh1cizE; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z22-20020a05640235d600b004358594050esi4689286edc.320.2022.06.20.15.51.55; Mon, 20 Jun 2022 15:52:22 -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=@kernel.org header.s=k20201202 header.b=fXh1cizE; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242935AbiFTWUp (ORCPT + 99 others); Mon, 20 Jun 2022 18:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243870AbiFTWUj (ORCPT ); Mon, 20 Jun 2022 18:20:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD371B796; Mon, 20 Jun 2022 15:20:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2C93611D9; Mon, 20 Jun 2022 22:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 415DAC3411B; Mon, 20 Jun 2022 22:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655763634; bh=jG3hNc3HY7o8s2RFDc2C+XAxckGdI/PbpjhwaH1AXKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXh1cizEODZ4SMedxiPCazh6QGP5XJe+ddgxpEMuYmJ7YyDrh8UglNT2xW5j7mB19 DY8TvVoI9SwRXzF354hU/qLIUlY1JEk0CYtiaFHsB33lZUdS6xWlDUPEd2hTq+leNJ TGvtgjGHXU42yI41xTbYXRtkiHNWaOVK/MMG6XqYQF1HvnXU1C9C+XVUmSzf5UMtd2 c1uKiHRF1NHTl50JRyXFZC8HiqWj69y+TleFGWEAtEfLS3L6f1in3Vv5MZFozPT4/3 yIJ7C5ycqtulJ3+J+ex53zm8FmPehhnd2q+ml/i7kTvl1DC2SAMGZ+oNARhWvvC73B YeKVhUjonEthg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id F13D25C05B9; Mon, 20 Jun 2022 15:20:33 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 01/12] rcu: Decrease FQS scan wait time in case of callback overloading Date: Mon, 20 Jun 2022 15:20:21 -0700 Message-Id: <20220620222032.3839547-1-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> References: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 force-quiesce-state loop function rcu_gp_fqs_loop() checks for callback overloading and does an immediate initial scan for idle CPUs if so. However, subsequent rescans will be carried out at as leisurely a rate as they always are, as specified by the rcutree.jiffies_till_next_fqs module parameter. It might be tempting to just continue immediately rescanning, but this turns the RCU grace-period kthread into a CPU hog. It might also be tempting to reduce the time between rescans to a single jiffy, but this can be problematic on larger systems. This commit therefore divides the normal time between rescans by three, rounding up. Thus a small system running at HZ=1000 that is suffering from callback overload will wait only one jiffy instead of the normal three between rescans. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index c25ba442044a6..c19d5926886fb 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -1993,6 +1993,11 @@ static noinline_for_stack void rcu_gp_fqs_loop(void) WRITE_ONCE(rcu_state.jiffies_kick_kthreads, jiffies + (j ? 3 * j : 2)); } + if (rcu_state.cbovld) { + j = (j + 2) / 3; + if (j <= 0) + j = 1; + } trace_rcu_grace_period(rcu_state.name, rcu_state.gp_seq, TPS("fqswait")); WRITE_ONCE(rcu_state.gp_state, RCU_GP_WAIT_FQS); -- 2.31.1.189.g2e36527f23