public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ankur Arora <ankur.a.arora@oracle.com>
Cc: bigeasy@linutronix.de, tglx@linutronix.de, mingo@kernel.org,
	linux-kernel@vger.kernel.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, efault@gmx.de
Subject: Re: [PATCH 2/5] sched: Add Lazy preemption model
Date: Tue, 8 Oct 2024 16:48:29 +0200	[thread overview]
Message-ID: <20241008144829.GG14587@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <877cajdu8x.fsf@oracle.com>

On Mon, Oct 07, 2024 at 10:43:58PM -0700, Ankur Arora wrote:

> > @@ -519,7 +525,7 @@ static inline bool preempt_model_rt(void
> >   */
> >  static inline bool preempt_model_preemptible(void)
> >  {
> > -	return preempt_model_full() || preempt_model_rt();
> > +	return preempt_model_full() || preempt_model_lazy() || preempt_model_rt();
> >  }
> 
> In addition to preempt_model_preemptible() we probably also need
> 
>   static inline bool preempt_model_minimize_latency(void)
>   {
>   	return preempt_model_full() || preempt_model_rt();
>   }
> 
> for spin_needbreak()/rwlock_needbreak().
> 
> That would make the behaviour of spin_needbreak() under the lazy model
> similar to none/voluntary.

That whole thing needs rethinking, for one the preempt_model_rt() one
doesn't really make sense anymore at the end of this.

> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -1078,6 +1078,9 @@ static void __resched_curr(struct rq *rq
> >
> >  	lockdep_assert_rq_held(rq);
> >
> > +	if (is_idle_task(curr) && tif == TIF_NEED_RESCHED_LAZY)
> > +		tif = TIF_NEED_RESCHED;
> > +
> 
> Tasks with idle policy get handled at the usual user space boundary.
> Maybe a comment reflecting that?

is_idle_task() != SCHED_IDLE. This is about the idle task, which you
want to force preempt always. But I can stick a comment on.

> > @@ -5598,6 +5627,10 @@ void sched_tick(void)
> >  	update_rq_clock(rq);
> >  	hw_pressure = arch_scale_hw_pressure(cpu_of(rq));
> >  	update_hw_load_avg(rq_clock_task(rq), rq, hw_pressure);
> > +
> > +	if (dynamic_preempt_lazy() && tif_test_bit(TIF_NEED_RESCHED_LAZY))
> > +		resched_curr(rq);
> > +
> 
> So this works for SCHED_NORMAL. But, does this do the right thing for
> deadline etc other scheduling classes?

Yeah, only fair.c uses resched_curr_laz8(), the others still use
resched_curr() and will work as if Full.

So that is: SCHED_IDLE, SCHED_BATCH and SCHED_NORMAL/OTHER get the lazy
thing, FIFO, RR and DEADLINE get the traditional Full behaviour.

  reply	other threads:[~2024-10-08 14:48 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07  7:46 [PATCH 0/5] sched: Lazy preemption muck Peter Zijlstra
2024-10-07  7:46 ` [PATCH 1/5] sched: Add TIF_NEED_RESCHED_LAZY infrastructure Peter Zijlstra
2024-10-09 12:18   ` Sebastian Andrzej Siewior
2024-10-09 13:01     ` Peter Zijlstra
2024-11-06 10:48   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-10-07  7:46 ` [PATCH 2/5] sched: Add Lazy preemption model Peter Zijlstra
2024-10-08  5:43   ` Ankur Arora
2024-10-08 14:48     ` Peter Zijlstra [this message]
2024-10-09  8:50   ` Sebastian Andrzej Siewior
2024-10-09  9:14     ` Peter Zijlstra
2024-10-09  9:19       ` Sebastian Andrzej Siewior
2024-10-15 14:37   ` Shrikanth Hegde
2024-10-25 10:42     ` Sebastian Andrzej Siewior
2024-10-22 16:44   ` Shrikanth Hegde
2024-10-25 13:19     ` Sebastian Andrzej Siewior
2024-10-29 18:57       ` Shrikanth Hegde
2024-11-06 10:48   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-10-07  7:46 ` [PATCH 3/5] sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT Peter Zijlstra
2024-10-08 13:24   ` Sebastian Andrzej Siewior
2024-10-08 14:40     ` Peter Zijlstra
2024-10-10  6:52   ` Christoph Hellwig
2024-10-10  7:50     ` Peter Zijlstra
2024-11-06 10:48   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-10-07  7:46 ` [PATCH 4/5] sched, x86: Enable Lazy preemption Peter Zijlstra
2024-11-06 10:48   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2024-10-07  7:46 ` [PATCH 5/5] sched: Add laziest preempt model Peter Zijlstra
2024-10-08  5:59   ` Ankur Arora
2024-10-08 14:23   ` Thomas Gleixner
2024-10-08 14:40     ` Peter Zijlstra
2024-10-08 15:07   ` Sebastian Andrzej Siewior
2024-10-07  8:33 ` [PATCH 0/5] sched: Lazy preemption muck Sebastian Andrzej Siewior
2024-10-08  4:58 ` Mike Galbraith
2024-10-08 15:32 ` Sebastian Andrzej Siewior
2024-10-09  4:40   ` Ankur Arora
2024-10-09  6:20     ` Sebastian Andrzej Siewior
2024-10-09  7:23       ` Ankur Arora
2024-10-09  8:02       ` Peter Zijlstra
2024-10-09  8:45         ` Sebastian Andrzej Siewior
2024-10-09 14:01         ` Steven Rostedt
2024-10-09 20:13           ` Thomas Gleixner
2024-10-09 20:43             ` Steven Rostedt
2024-10-09 21:06               ` Thomas Gleixner
2024-10-09 21:19                 ` Steven Rostedt
2024-10-09 23:16                   ` Thomas Gleixner
2024-10-09 23:29                     ` Steven Rostedt
2024-10-10  1:20                       ` Thomas Gleixner
2024-10-10 10:23                 ` David Laight
2024-10-13 19:02                   ` Thomas Gleixner
2024-10-14  8:21                     ` David Laight
2024-10-10  3:12               ` Tianchen Ding
2024-10-10  7:47                 ` Thomas Gleixner
2024-10-09  7:30   ` Ankur Arora
2024-10-09  7:46   ` Peter Zijlstra
2024-10-09 11:07 ` Sebastian Andrzej Siewior
2024-10-17 12:36 ` Mike Galbraith
2024-11-07 17:21   ` Thomas Meyer
2024-11-08  0:59     ` Mike Galbraith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241008144829.GG14587@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ankur.a.arora@oracle.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=efault@gmx.de \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox