lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4c4d6919-6e06-45fd-9f55-c14bba9c8598@paulmck-laptop>
Date:   Tue, 11 Apr 2023 21:49:49 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     "Uladzislau Rezki (Sony)" <urezki@...il.com>
Cc:     RCU <rcu@...r.kernel.org>, quic_neeraju@...cinc.com,
        Boqun Feng <boqun.feng@...il.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Oleksiy Avramchenko <oleksiy.avramchenko@...y.com>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH 1/1] rcu/kvfree: Do not run a page work if a cache is
 disabled

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@...il.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@...il.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@...il.com>
    Signed-off-by: Paul E. McKenney <paulmck@...nel.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)) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ