[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250807023510.38502-1-wangfushuai@baidu.com>
Date: Thu, 7 Aug 2025 10:35:10 +0800
From: Fushuai Wang <wangfushuai@...du.com>
To: <linux-kernel@...r.kernel.org>
CC: <tytso@....edu>, <Jason@...c4.com>, Fushuai Wang <wangfushuai@...du.com>
Subject: [PATCH] random: Use cpumask_next_wrap() in try_to_generate_entropy()
Replace the manual sequence of cpumask_next() and cpumask_first()
with a single call to cpumask_next_wrap() in try_to_generate_entropy().
Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
---
drivers/char/random.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index b8b24b6ed3fe..f85f35777c9b 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1336,9 +1336,7 @@ static void __cold try_to_generate_entropy(void)
/* Basic CPU round-robin, which avoids the current CPU. */
do {
- cpu = cpumask_next(cpu, &timer_cpus);
- if (cpu >= nr_cpu_ids)
- cpu = cpumask_first(&timer_cpus);
+ cpu = cpumask_next_wrap(cpu, &timer_cpus);
} while (cpu == smp_processor_id() && num_cpus > 1);
/* Expiring the timer at `jiffies` means it's the next tick. */
--
2.36.1
Powered by blists - more mailing lists