All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/deadline: Do not start hrtick if its disabled for DL
@ 2024-11-12  1:22 Joel Fernandes (Google)
  2024-11-12  7:51 ` Juri Lelli
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Fernandes (Google) @ 2024-11-12  1:22 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Valentin Schneider
  Cc: Joel Fernandes (Google), Aashish Sharma, Vineeth Pillai

Fix an issue where high-resolution timers causes aggressive preemptions,
leading to increased idle times in CFS tasks (which are inside the DL
server). The problem was traced to improper usage of hrtick_enabled(),
which could start high-resolution ticks unexpectedly causing repeated
preemptions.

The fix replaces this call with hrtick_enabled_dl(), aligning it with
scheduler feature checks.

Reported-by: Aashish Sharma <shraash@google.com>
Reported-by: Vineeth Pillai <vineeth@bitbyteword.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index b216e6deeac4..d46502b9ce58 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2121,7 +2121,7 @@ static struct task_struct *pick_next_task_dl(struct rq *rq)
 	if (!p->dl_server)
 		set_next_task_dl(rq, p, true);
 
-	if (hrtick_enabled(rq))
+	if (hrtick_enabled_dl(rq))
 		start_hrtick_dl(rq, &p->dl);
 
 	return p;
-- 
2.47.0.277.g8800431eea-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/deadline: Do not start hrtick if its disabled for DL
  2024-11-12  1:22 [PATCH] sched/deadline: Do not start hrtick if its disabled for DL Joel Fernandes (Google)
@ 2024-11-12  7:51 ` Juri Lelli
  2024-11-12 18:36   ` Joel Fernandes
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Lelli @ 2024-11-12  7:51 UTC (permalink / raw)
  To: Joel Fernandes (Google)
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, Aashish Sharma,
	Vineeth Pillai

Hi Joel,

On 12/11/24 01:22, Joel Fernandes (Google) wrote:
> Fix an issue where high-resolution timers causes aggressive preemptions,
> leading to increased idle times in CFS tasks (which are inside the DL
> server). The problem was traced to improper usage of hrtick_enabled(),
> which could start high-resolution ticks unexpectedly causing repeated
> preemptions.
> 
> The fix replaces this call with hrtick_enabled_dl(), aligning it with
> scheduler feature checks.
> 
> Reported-by: Aashish Sharma <shraash@google.com>
> Reported-by: Vineeth Pillai <vineeth@bitbyteword.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  kernel/sched/deadline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index b216e6deeac4..d46502b9ce58 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2121,7 +2121,7 @@ static struct task_struct *pick_next_task_dl(struct rq *rq)
>  	if (!p->dl_server)
>  		set_next_task_dl(rq, p, true);
>  
> -	if (hrtick_enabled(rq))
> +	if (hrtick_enabled_dl(rq))
>  		start_hrtick_dl(rq, &p->dl);
>  
>  	return p;
> -- 

I'm not sure I'm seeing this in current code. We have two users in
deadline.c and they both use hrtick_enabled_dl (after a recent fix by
Phil).

Best,
Juri


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/deadline: Do not start hrtick if its disabled for DL
  2024-11-12  7:51 ` Juri Lelli
@ 2024-11-12 18:36   ` Joel Fernandes
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2024-11-12 18:36 UTC (permalink / raw)
  To: Juri Lelli
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, Aashish Sharma,
	Vineeth Pillai

On Tue, Nov 12, 2024 at 07:51:17AM +0000, Juri Lelli wrote:
> Hi Joel,
> 
> On 12/11/24 01:22, Joel Fernandes (Google) wrote:
> > Fix an issue where high-resolution timers causes aggressive preemptions,
> > leading to increased idle times in CFS tasks (which are inside the DL
> > server). The problem was traced to improper usage of hrtick_enabled(),
> > which could start high-resolution ticks unexpectedly causing repeated
> > preemptions.
> > 
> > The fix replaces this call with hrtick_enabled_dl(), aligning it with
> > scheduler feature checks.
> > 
> > Reported-by: Aashish Sharma <shraash@google.com>
> > Reported-by: Vineeth Pillai <vineeth@bitbyteword.org>
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> > ---
> >  kernel/sched/deadline.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index b216e6deeac4..d46502b9ce58 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -2121,7 +2121,7 @@ static struct task_struct *pick_next_task_dl(struct rq *rq)
> >  	if (!p->dl_server)
> >  		set_next_task_dl(rq, p, true);
> >  
> > -	if (hrtick_enabled(rq))
> > +	if (hrtick_enabled_dl(rq))
> >  		start_hrtick_dl(rq, &p->dl);
> >  
> >  	return p;
> > -- 
> 
> I'm not sure I'm seeing this in current code. We have two users in
> deadline.c and they both use hrtick_enabled_dl (after a recent fix by
> Phil).

Ah you're right. The latest kernel we are on is on 6.6 so this got missed.

Thanks Juri for your quick reply and pointing out the missing patches!

 - Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-12 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12  1:22 [PATCH] sched/deadline: Do not start hrtick if its disabled for DL Joel Fernandes (Google)
2024-11-12  7:51 ` Juri Lelli
2024-11-12 18:36   ` Joel Fernandes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.