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

From: Ankur Arora
Date: Mon Aug 12 2024 - 18:37:27 EST



Christoph Lameter (Ampere) <cl@xxxxxxxxxx> writes:

> 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.

That's a good idea. Will fix.

>>
>> 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>

Thanks for the review.

--
ankur