]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rcu: Simplify rcu_do_batch() by applying clamp()
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 8 May 2026 17:43:51 +0000 (10:43 -0700)
committerUladzislau Rezki (Sony) <urezki@gmail.com>
Sun, 24 May 2026 07:39:52 +0000 (09:39 +0200)
This commit replaces a nested ?: sequence with clamp().  This does not
reduce the number of lines of code, but it does simplify the line that
it modifies.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
kernel/rcu/tree.c

index 55df6d37145e8717de08b1b1928777393eee7eea..e46a5124c3eb8824c07a06bfa697d7fce6b044d0 100644 (file)
@@ -2584,7 +2584,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
                const long npj = NSEC_PER_SEC / HZ;
                long rrn = READ_ONCE(rcu_resched_ns);
 
-               rrn = rrn < NSEC_PER_MSEC ? NSEC_PER_MSEC : rrn > NSEC_PER_SEC ? NSEC_PER_SEC : rrn;
+               rrn = clamp(rrn, NSEC_PER_MSEC, NSEC_PER_SEC);
                tlimit = local_clock() + rrn;
                jlimit = jiffies + (rrn + npj + 1) / npj;
                jlimit_check = true;