diff mbox series

[08/15] mm/damon/core: Use generic upper bound recommondation for usleep_range()

Message ID 20240904-devel-anna-maria-b4-timers-flseep-v1-8-e98760256370@linutronix.de (mailing list archive)
State New
Headers show
Series timers: Cleanup delay/sleep related mess | expand

Commit Message

Anna-Maria Behnsen Sept. 4, 2024, 1:04 p.m. UTC
The upper bound for usleep_range_idle() was taken from the outdated
documentation. As a recommondation for the upper bound of usleep_range()
depends on HZ configuration it is not possible to hard code it.

Use the define "USLEEP_RANGE_UPPER_BOUND" instead.

Cc: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: damon@lists.linux.dev
Cc: linux-mm@kvack.org
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
 mm/damon/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

SeongJae Park Sept. 6, 2024, 4:31 p.m. UTC | #1
On Wed, 04 Sep 2024 15:04:58 +0200 Anna-Maria Behnsen <anna-maria@linutronix.de> wrote:

> The upper bound for usleep_range_idle() was taken from the outdated
> documentation. As a recommondation for the upper bound of usleep_range()
> depends on HZ configuration it is not possible to hard code it.
> 
> Use the define "USLEEP_RANGE_UPPER_BOUND" instead.
> 
> Cc: SeongJae Park <sj@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: damon@lists.linux.dev
> Cc: linux-mm@kvack.org
> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> ---
>  mm/damon/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 94fe2f1f9b0e..4b971871da75 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1883,8 +1883,7 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme)
>  
>  static void kdamond_usleep(unsigned long usecs)
>  {
> -	/* See Documentation/timers/timers-howto.rst for the thresholds */
> -	if (usecs > 20 * USEC_PER_MSEC)
> +	if (usecs >= USLEEP_RANGE_UPPER_BOUND)
>  		schedule_timeout_idle(usecs_to_jiffies(usecs));
>  	else
>  		usleep_range_idle(usecs, usecs + 1);
> 
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 94fe2f1f9b0e..4b971871da75 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1883,8 +1883,7 @@  static unsigned long damos_wmark_wait_us(struct damos *scheme)
 
 static void kdamond_usleep(unsigned long usecs)
 {
-	/* See Documentation/timers/timers-howto.rst for the thresholds */
-	if (usecs > 20 * USEC_PER_MSEC)
+	if (usecs >= USLEEP_RANGE_UPPER_BOUND)
 		schedule_timeout_idle(usecs_to_jiffies(usecs));
 	else
 		usleep_range_idle(usecs, usecs + 1);