Re: [PATCH v6 01/10] cpuidle/poll_state: poll via smp_cond_load_relaxed()

From: Christoph Lameter (Ampere)
Date: Mon Aug 05 2024 - 20:18:45 EST


On Fri, 26 Jul 2024, Ankur Arora wrote:

diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c
index 9b6d90a72601..532e4ed19e0f 100644
--- a/drivers/cpuidle/poll_state.c
+++ b/drivers/cpuidle/poll_state.c
@@ -21,21 +21,21 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev,

raw_local_irq_enable();
if (!current_set_polling_and_test()) {
- unsigned int loop_count = 0;
+ unsigned int loop_count;
u64 limit;

loop_count is only used in the while loop below. So the declaration could be placed below the while.


limit = cpuidle_poll_time(drv, dev);

while (!need_resched()) {
- cpu_relax();
- if (loop_count++ < POLL_IDLE_RELAX_COUNT)
- continue;
-
loop_count = 0;
if (local_clock_noinstr() - time_start > limit) {
dev->poll_time_limit = true;
break;
}

Looks ok otherwise

Reviewed-by: Christoph Lameter <cl@xxxxxxxxx>