[Devel] [PATCH RHEL9 COMMIT] blk-cbt: Don't disable interrupts when working with percpu cache

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 7 21:16:44 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.vz9.18.12
------>
commit 70bcc2e38a90c4738e9c245372dbf2b8ee7f60e0
Author: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
Date:   Tue Jan 31 14:24:00 2023 +0200

    blk-cbt: Don't disable interrupts when working with percpu cache
    
    When working with percpu variables the only guarantee we need is that
    the process is not preempted. So let's do this by using the more
    idiomatic get_cpu_ptr/put_cpu_ptr rather than the more heavyweight
    local_irq_disable. No functional changes.
    
    Fixes: ea18c5e9d2ba ("cbt: introduce changed block tracking")
    
    Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
---
 block/blk-cbt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index b78ea8fd4608..73f28d8ccf6d 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -238,17 +238,16 @@ static void blk_cbt_add(struct request_queue *q, blkcnt_t start, blkcnt_t len)
 		__blk_cbt_set(cbt, start, len, 1, 1, NULL, NULL);
 		goto out_rcu;
 	}
-	local_irq_disable();
-	ex = this_cpu_ptr(cbt->cache);
+	ex = get_cpu_ptr(cbt->cache);
 	if (ex->start + ex->len == start) {
 		ex->len += len;
-		local_irq_enable();
+		put_cpu_ptr(cbt->cache);
 		goto out_rcu;
 	}
 	old = *ex;
 	ex->start = start;
 	ex->len = len;
-	local_irq_enable();
+	put_cpu_ptr(cbt->cache);
 
 	if (likely(old.len))
 		__blk_cbt_set(cbt, old.start, old.len, 1, 1, NULL, NULL);


More information about the Devel mailing list