Message ID | 20230411131341.9910-1-urezki@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2579778vqo; Tue, 11 Apr 2023 06:34:48 -0700 (PDT) X-Google-Smtp-Source: AKy350brepocQlGR2QAcLYT4Ssa7QAFz6nfRvCGfha1wR43pnmR6IgqSvs1i+nffBQNH567NQh06 X-Received: by 2002:a05:6402:2036:b0:504:8c0d:4e28 with SMTP id ay22-20020a056402203600b005048c0d4e28mr10378264edb.35.1681220088186; Tue, 11 Apr 2023 06:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681220088; cv=none; d=google.com; s=arc-20160816; b=oho4AFw2vWohOkDlOlUF+PIAZa9bpbrVp4cLl0fNZPQgpC/JpG38IoQ04+2/n9yvrT RpHDPIVF1+AoP04FiYnY27gJeLWirFyI/GIUyL/T8w9Emo2RrMCpxprfR+ESCKYbQYLW V/G/MO4HwdfRRvmNoVEZ6Is0J+eQ2F03vEV2XBuHJ5h40ceR27Ic8Aalw6yhlON7znLe 5IsNncH+EuMpxaLJQXvqmt0K5+pGSwJO7dn5T27St8sSALuD+NztqOalhCTcVlG5xL81 taxovdTbVgAmgA/+NURJm/+irlT45We2hVGHm8SuHdvcb0SWl+xSXReQjq3I4QvflfDx IxPw== 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=YENHw+0ET+w+YdgKcOWDuPPqjwQPjQ7l4ozH72ShpYo=; b=ZHSybTbh9wyv3L2GppszbWBd7JzmPuAfG/qayIHVeEP9qgL+0UP6146d1lY5W5eJQB VjlJ4yV9W8PjpP0FWoLM3mx7hoVqP51kYV1o4RbkjI4z4K1JIMeBrax+jLVf8REp3HRM nCwXd7BzFMn+D0DNxiMOvLqhcRxwkFbue1HNkkSEB11Oei5RDN3Z2hQnELK8RhDBJZwb k6g0DqBoCt+IHLN2ETUwhdVr4EIYzGs0p2rpYiNilwu4AkwVMmrauIx9JgefLRCfaz8F gbxnG7R9IeES2goM6UMcSXuz62p3vzeOB2+O61s+q0Gt+C9HCsEEHOCM+nJvFzoOTNU0 gJxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jEOci7L6; 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=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402134900b00504a22bd3e9si948744edw.145.2023.04.11.06.31.36; Tue, 11 Apr 2023 06:34:48 -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=@gmail.com header.s=20210112 header.b=jEOci7L6; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbjDKNNw (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Tue, 11 Apr 2023 09:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjDKNNu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Apr 2023 09:13:50 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D35873C3B; Tue, 11 Apr 2023 06:13:45 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id gb34so20420414ejc.12; Tue, 11 Apr 2023 06:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681218824; x=1683810824; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YENHw+0ET+w+YdgKcOWDuPPqjwQPjQ7l4ozH72ShpYo=; b=jEOci7L6JgQ3ZrujnEk5pp7rYH/FVactWqhOpesWfHl0NdGbhTY+lyQCYxRenXEziK SyoZ/PI+Aq2e18lbnmxb9GHzGQQG3dCLMjAL4nuWTvC2QYTHyNFribZYutNatC8VyaWa w8MHPhvbugNcFUIIjx/LNIfvoGIdNOOCgESbYBuaIJy4eEooU+8L5xvBeDXZ3ZMN+Csf CbHq2UQgHLvfWMZ0tkwSzf16yG5Q+4bxLsFQyFk7oPJrTVKwznM8h/SzTO2vf9gZx+9g 6tSyhQ7IlrHAocQ95UzWFlkxv+M7tN0Z+OFc0a9nHCS8iknwQy3FshOhnyBND+xN16qs s/SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681218824; x=1683810824; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YENHw+0ET+w+YdgKcOWDuPPqjwQPjQ7l4ozH72ShpYo=; b=hSU15Gz0BM45NVKFiI7/ng02eeAcaI1TWf6XdVCmlxHtVON5NlroRl3rePeRF5OGhD L6H1NXa4lC7R4VhLSryCwJwif24xV1l9bQLjBox9ojAiJvyFsnB/+dXvhl2wfOO5Aedi /FPzSC+RfjCjEuOpUfdXeRsbeQXekVdoDmCJimhC65U/6LNLJx77kzdh3UknFvTjq5kM kxKQys9Pcc9CtIllgvj3nPsbSxjjZRmawkBJAX2jKCCcrgRE7c351iEDFZc23e0YsGXS PJeCENjyHKjNm9pYsJpl8kROgiu+sEsiSfSMBbfuz9cfyple2jwWjnJ97HUVRnGYpuu5 wEng== X-Gm-Message-State: AAQBX9e3JGf9DSCpfde7tSlhHiVPzVdD+G6QDcF8AdHREkoKrW6FeA+5 +L7vSEwV4/vPfRC73AZYhDE= X-Received: by 2002:a17:907:8a85:b0:878:481c:c49b with SMTP id sf5-20020a1709078a8500b00878481cc49bmr11201293ejc.1.1681218824091; Tue, 11 Apr 2023 06:13:44 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id k5-20020a1709061c0500b0094c3ac3c2bbsm1383905ejg.212.2023.04.11.06.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 06:13:43 -0700 (PDT) From: "Uladzislau Rezki (Sony)" <urezki@gmail.com> To: "Paul E . McKenney" <paulmck@kernel.org> Cc: RCU <rcu@vger.kernel.org>, quic_neeraju@quicinc.com, Boqun Feng <boqun.feng@gmail.com>, Joel Fernandes <joel@joelfernandes.org>, LKML <linux-kernel@vger.kernel.org>, Uladzislau Rezki <urezki@gmail.com>, Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>, Frederic Weisbecker <frederic@kernel.org> Subject: [PATCH 1/1] rcu/kvfree: Do not run a page work if a cache is disabled Date: Tue, 11 Apr 2023 15:13:41 +0200 Message-Id: <20230411131341.9910-1-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762887034974853331?= X-GMAIL-MSGID: =?utf-8?q?1762887034974853331?= |
Series |
[1/1] rcu/kvfree: Do not run a page work if a cache is disabled
|
|
Commit Message
Uladzislau Rezki
April 11, 2023, 1:13 p.m. UTC
By default the cache size is 5 pages per-cpu. But it can
be disabled at boot time by setting the rcu_min_cached_objs
to zero.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
kernel/rcu/tree.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Tue, Apr 11, 2023 at 03:13:41PM +0200, Uladzislau Rezki (Sony) wrote: > By default the cache size is 5 pages per-cpu. But it can > be disabled at boot time by setting the rcu_min_cached_objs > to zero. > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> That does get rid of a needless hrtimer &c in that case, good! I have queued this with the usual wordsmithing below, so please check it. Thanx, Paul ------------------------------------------------------------------------ commit 5e433764beec0134a9a677f399a6e4539eb8870d Author: Uladzislau Rezki (Sony) <urezki@gmail.com> Date: Tue Apr 11 15:13:41 2023 +0200 rcu/kvfree: Do not run a page work if a cache is disabled By default the cache size is 5 pages per CPU, but it can be disabled at boot time by setting the rcu_min_cached_objs to zero. When that happens, the current code will uselessly set an hrtimer to schedule refilling this cache with zero pages. This commit therefore streamlines this process by simply refusing the set the hrtimer when rcu_min_cached_objs is zero. Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 41daae3239b5..f855d2a85597 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3247,6 +3247,10 @@ static void fill_page_cache_func(struct work_struct *work) static void run_page_cache_worker(struct kfree_rcu_cpu *krcp) { + // If cache disabled, bail out. + if (!rcu_min_cached_objs) + return; + if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && !atomic_xchg(&krcp->work_in_progress, 1)) { if (atomic_read(&krcp->backoff_page_cache_fill)) {
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 35be35f8236b..21e3d9dffde5 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3246,6 +3246,10 @@ static void fill_page_cache_func(struct work_struct *work) static void run_page_cache_worker(struct kfree_rcu_cpu *krcp) { + // If cache disabled, bail out. + if (!rcu_min_cached_objs) + return; + if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && !atomic_xchg(&krcp->work_in_progress, 1)) { if (atomic_read(&krcp->backoff_page_cache_fill)) {