[PATCH] iopoll: use fsleep() instead of usleep_range()

Andi Shyti andi.shyti at kernel.org
Wed Jul 2 18:16:14 UTC 2025


Hi Jani,

On Thu, Jun 26, 2025 at 05:51:19PM +0300, Jani Nikula wrote:
> Sometimes it's necessary to poll with long sleeps, and the accuracy of
> usleep_range() is overkill. Use the flexible sleep helper fsleep() for
> sleeping in the read_poll_timeout() family of macros to automatically
> choose the appropriate method of waiting.
> 
> Functionally there are a few consequences for existing users:
> 
> - 10 us and shorter sleeps will use usleep() instead of
>   usleep_range(). Presumably this will not be an issue.
> 
> - When it leads to a slack of less than 25%, msleep() will be used
>   instead of usleep_range(). Presumably this will not be an issue, given
>   the sleeps will be longer in this case.
> 
> - Otherwise, the usleep_range() slack gets switched from the begin of
>   the range to the end of the range, i.e. [sleep/2+1..sleep] ->
>   [sleep..sleep+sleep/2]. In theory, this could be an issue in some
>   cases, but difficult to determine before this hits the real world.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

this patch makes sense to me even with the fixes in the commit
message suggested byt Geert.

Reviewed-by: Andi Shyti <andi.shyti at kernel.org>

Andi


More information about the Intel-gfx mailing list