Re: [PATCH v1] iopoll: Tweak readx_poll_timeout sleep range

From: Arnd Bergmann
Date: Thu Jun 13 2019 - 11:26:53 EST


On Thu, Jun 13, 2019 at 2:16 PM Marc Gonzalez <marc.w.gonzalez@xxxxxxx> wrote:
>
> Chopping max delay in 4 seems excessive. Let's just cut it in half.
>
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@xxxxxxx>
> ---
> When max_us=100, old_min was 26 us; new_min would be 50 us
> Was there a good reason for the 1/4th?
> Is new_min=0 a problem? (for max=1)

You normally want a large enough range between min and max. I don't
see anything wrong with a factor of four.

> @@ -47,7 +47,7 @@
> break; \
> } \
> if (__sleep_us) \
> - usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
> + usleep_range(__sleep_us / 2, __sleep_us); \
> } \

You are also missing the '+1' now, so this breaks with __sleep_us=1.

Arnd