Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2990870pxk; Mon, 28 Sep 2020 05:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcWlbH2Py5AzESEISKvq/5BrxVn+fjCm7giqBqnrrSz1hhkB6oAOLQzMZHaYiQEqFQMwBC X-Received: by 2002:a50:8045:: with SMTP id 63mr1622737eda.24.1601297439359; Mon, 28 Sep 2020 05:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601297439; cv=none; d=google.com; s=arc-20160816; b=GMeECtL2GlGcjztnOMwjzkwP2lbQ4a1NrQ+48wFAIZTPjF/HUdu3qzcSC+vYdw/bVf ZUtxJoTrqVi9mQDgrZwNG1WKealKI/fBT8El1/jw6vNGP8B0PmA+Gcj37xshPPozrwvK 0TEMGGK7v5SuFS/65JCNYADKf4qH4vW9AT7RPCYxxmoImlUJtkk1KsgT676UXfW4aVAQ J5KuON1PB904NOX+liBe3xAxXy/SnpV+F83qr4oRxNO4i2vAtzmwymnfpjslHXDLTFNb TPqfosJyOiRtboTHqobJNQjQi30vbfNM8clmTmAykRBFib0mLXvGO9T6PPHbmC1Fny43 IeNA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=dbSiDedMj6Fi2FYAEkzpCM05qVLOKb0E2B69e7H8fn8=; b=L31WAVmspFj5c5XqMou5MUueupxaoHnLvNFmifskNeG3Vjxq8XEnDne1/Myq0MaCTc BPXKpLY+QisjUHlHBomOy2zG6g4ZQWoGF/LXCNqG5UkitA8sDYSrRrpI6Ak+Ax4vxdPQ Q+Ao660ytlGWhZMG1/8CpuFEoQD8rAsTOGOFxrW/9YTMyTLo46nBbXrp/y84iQQcj+n3 pagXaG8MseAjqd1mrfPZwR/1c8Lb90TAK1YVOTmSn0hp5Y5xHM2sh5EA49sVV9kxNubx WOmsKUFGGaHVbsLE36kM8gyhdWC7/kkzPfeJ/YAuDmT0Sojf6yeCdcnpEfGggjIpQ839 eHFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=TEKdCS8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si548408eds.237.2020.09.28.05.50.15; Mon, 28 Sep 2020 05:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=TEKdCS8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726576AbgI1Mqn (ORCPT + 99 others); Mon, 28 Sep 2020 08:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgI1Mqk (ORCPT ); Mon, 28 Sep 2020 08:46:40 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E8CC0613CE for ; Mon, 28 Sep 2020 05:46:40 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id n10so581723qtv.3 for ; Mon, 28 Sep 2020 05:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dbSiDedMj6Fi2FYAEkzpCM05qVLOKb0E2B69e7H8fn8=; b=TEKdCS8Dxi3PrABwVjZpWaEAS70Pbf9sgKwKP0IbyLaSRsiBQ6U3DRPSQ9YYx8UrYI 3b4PiAXkBJDmaSXNL6H5E6k68j2iTaYCDj6E6a8oWULeBDCXdMcBjUkwDmZwLIolrbib J/2bbA9sjUn8ymiri3oABrQ4Kin+zyioWXMm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dbSiDedMj6Fi2FYAEkzpCM05qVLOKb0E2B69e7H8fn8=; b=V7Yyo5/iQJhxjpptZlbKXNw3cQMzvKaitUrOjwWNfo+Td1iHEfvGb8cCbcJy6KVaOi 8p/GEqNy9keZj0jdVXBUi6J/l3ymkJe3diIvO7L0tAZwJRbKYe0LJtcOBPvkGFU/52Wg SCGzBvR+CywRBfEHXD6rC48QkzfMywSxHZCr2hLh6qnmtAizJ2YhlFyerSoegbwN6HYg vflQn7V/WpqXo9V7U/4TyoMFep9NWVLblYTvqlgTuN7Se+QzzwjeibLlXdmWw382C/r4 gGpw7ebA6XtO3jXk0t9PbYi2UkLbTJkuZv+jI/cIe9f1Yiaajf9CxPfJAYMc8771J4Kq Zyqg== X-Gm-Message-State: AOAM531wlS+5LRNVp+3pxeQZzw4STfWObXRLBCxfT65jbC8Xc4Ycsy4b bP2a0Y7RrG+cEIIL9s8G2MFVW24kM5jHtg== X-Received: by 2002:ac8:18da:: with SMTP id o26mr568249qtk.92.1601297199518; Mon, 28 Sep 2020 05:46:39 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id g5sm974902qtx.43.2020.09.28.05.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 05:46:38 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , neeraju@codeaurora.org, fweisbec@gmail.com, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt , peterz@infradead.org Subject: [PATCH] rcu/tree: nocb: Avoid raising softirq when CBs ready to execute Date: Mon, 28 Sep 2020 08:46:25 -0400 Message-Id: <20200928124625.1677571-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.28.0.709.gb0816b6eb0-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During testing, I see it is possible that rcu_pending() returns 1 when offloaded callbacks are ready to execute thus raising the RCU softirq. However, softirq does not execute offloaded callbacks. They are executed in a kthread which is awakened independent of the softirq. The softirq ignores the request. This commit therefore avoids raising the softirq in the first place. Considering that the purpose of callback offloading is to reduce softirq activity, avoiding the softirq in the first place is the right thing to do especially for systems that employ callback offloading to reduce real-time jitter. Passed 30 minute tests of TREE01 through TREE09 each. Cc: neeraju@codeaurora.org Cc: fweisbec@gmail.com Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 55d3700dd1e7..caea5bfec2c0 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3759,7 +3759,8 @@ static int rcu_pending(int user) return 1; /* Does this CPU have callbacks ready to invoke? */ - if (rcu_segcblist_ready_cbs(&rdp->cblist)) + if (!rcu_segcblist_is_offloaded(&rdp->cblist) && + rcu_segcblist_ready_cbs(&rdp->cblist)) return 1; /* Has RCU gone idle with this CPU needing another grace period? */ -- 2.28.0.709.gb0816b6eb0-goog