From: Paul E. McKenney Date: Fri, 8 May 2026 17:43:51 +0000 (-0700) Subject: rcu: Simplify rcu_do_batch() by applying clamp() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=5f136351edd37d779e45704d573f5b6d6cab1e6e;p=thirdparty%2Fkernel%2Flinux.git rcu: Simplify rcu_do_batch() by applying clamp() 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 Signed-off-by: Paul E. McKenney Signed-off-by: Uladzislau Rezki (Sony) --- diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 55df6d37145e8..e46a5124c3eb8 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -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;