mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zihan zhou <15645113830zzh@gmail.com>
To: vincent.guittot@linaro.org
Cc: 15645113830zzh@gmail.com, bsegall@google.com,
	dietmar.eggemann@arm.com, juri.lelli@redhat.com,
	linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com,
	peterz@infradead.org, rostedt@goodmis.org, vschneid@redhat.com,
	yaowenchao@jd.com, yaozhenguo@jd.com
Subject: Re: [PATCH V2] sched: Forward deadline for early tick
Date: Thu,  9 Jan 2025 13:48:53 +0800	[thread overview]
Message-ID: <20250109054852.92163-1-15645113830zzh@gmail.com> (raw)
In-Reply-To: <CAKfTPtAKmLw4WqeZ0uJEd33e2mJnaWM8ni3=J7YTSRBVNVymTg@mail.gmail.com>

Thank you for your reply!

> > There are two reasons for tick error: clockevent precision and the
> > CONFIG_IRQ_TIME_ACCOUNTING. with CONFIG_IRQ_TIME_ACCOUNTING every tick
> >  will less than 1ms, but even without it, because of clockevent precision,
> > tick still often less than 1ms. In the system above, there is no such
> >  config, but the task still often takes more than 3ms.
> >
> > To solve this problem, we add a sched feature FORWARD_DEADLINE,
> > consider forwarding the deadline appropriately. When vruntime is very
> > close to the deadline, and the task is ineligible, we consider that task
> >  should be resched, the tolerance is set to min(vslice/128, tick/2).
> 
> I'm worried with this approximation because the task didn't get the
> slice it has requested because of the stolen time by irq or a shorter
> tick duration

Yes, you are right. forward deadline is not a good way, although the error 
is small, the task will have less exec time.


> Yes but it also didn't say that you can move forward its deadline
> before it has consumed its slice request. A task is only ensured to
> get a discrete time quanta but can be preempted after each quanta even
> if its slice has not elapsed.
> 
> What you want, it's to trigger a need_resched after a minimum time
> quanta has elapsed but not to update the deadline before the slice has
> elapsed.
> 
> Now the question is what is the minimum time quanta for us. Should it
> be a tick whatever it's real duration for the task ? Should it be
> longer ?

I have also been thinking about this question: what is the appropriate
 minimum time quanta? I think neither tick nor slice is a good choice.
The task should have an atomic runtime greater than tick to avoid frequent
 switching, but if the time size is silce, it is not flexible, tasks often
use up the requested slice at once without caring about if they are
 eligible. So can we add a new kernel parameter, like 
sysctl_sched_min_granularity? Adding a min_granularity between tick and
 slice seems like a good choice.

We can let a task exec min_granularity time at once, then it is needed to
 consider whether the task is eligible or whether the deadline needs
 to be updated.


But I don't know how to handle wake up preemption more appropriately.
Is it necessary to wait for the preempted task to complete an atomic time?



  reply	other threads:[~2025-01-09  5:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-25  5:40 zihan zhou
2025-01-02 10:00 ` Vincent Guittot
2025-01-09  5:48   ` zihan zhou [this message]
2025-01-14 10:16     ` Vincent Guittot
2025-01-16  8:12       ` zihan zhou
2025-01-17  8:18         ` Vincent Guittot
2025-01-20  7:38           ` zihan zhou
2025-01-20 11:42             ` Honglei Wang
2025-01-20 13:39               ` Vincent Guittot
2025-01-21  2:46                 ` zihan zhou
2025-01-17 11:38 [PATCH V1] sched/debug: change "runnable tasks" to "Tasks on cpu" on sched debug Peter Zijlstra
2025-01-20  7:44 ` [PATCH V2] sched: Forward deadline for early tick zihan zhou
2025-01-20  7:55   ` zihan zhou

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=20250109054852.92163-1-15645113830zzh@gmail.com \
    --to=15645113830zzh@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yaowenchao@jd.com \
    --cc=yaozhenguo@jd.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

all inboxes | Powered by JetHome®