The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: Mike Galbraith <efault@gmx.de>
Cc: Chunxin Zang <spring.cxz@gmail.com>, <mingo@redhat.com>,
	<peterz@infradead.org>, <juri.lelli@redhat.com>,
	<vincent.guittot@linaro.org>, <dietmar.eggemann@arm.com>,
	<rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>,
	<bristot@redhat.com>, <vschneid@redhat.com>,
	<linux-kernel@vger.kernel.org>, <yangchen11@lixiang.com>,
	<zhouchunhua@lixiang.com>, <zangchunxin@lixiang.com>
Subject: Re: [PATCH] sched/fair: Reschedule the cfs_rq when current is ineligible
Date: Sat, 25 May 2024 19:57:41 +0800	[thread overview]
Message-ID: <ZlHSNXe0c5/sx9D9@chenyu5-mobl2> (raw)
In-Reply-To: <e17d3d90440997b970067fe9eaf088903c65f41d.camel@gmx.de>

On 2024-05-25 at 08:41:28 +0200, Mike Galbraith wrote:
> On Fri, 2024-05-24 at 21:40 +0800, Chunxin Zang wrote:
> > I found that some tasks have been running for a long enough time and
> > have become illegal, but they are still not releasing the CPU. This
> > will increase the scheduling delay of other processes. Therefore, I
> > tried checking the current process in wakeup_preempt and entity_tick,
> > and if it is illegal, reschedule that cfs queue.
> 
> My box gave making the XXX below reality a two thumbs up when fiddling
> with the original unfettered and a bit harsh RUN_TO_PARITY.
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 8a5b1ae0aa55..922834f172b0 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8413,12 +8413,13 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
>  	update_curr(cfs_rq);
> 
>  	/*
> -	 * XXX pick_eevdf(cfs_rq) != se ?
> +	 * Run @curr until it is no longer our best option.  Basing the preempt
> +	 * decision on @curr reselection puts any previous decisions back on the
> +	 * table in context "now", including granularity preservation decisions
> +	 * by RUN_TO_PARITY.
>  	 */
> -	if (pick_eevdf(cfs_rq) == pse)
> -		goto preempt;
> -
> -	return;
> +	if (pick_eevdf(cfs_rq) == se)
> +		return;
>

I suppose this change benefits the overloaded scenario:
neither current nor the wakee is the best one.

before: current continues to run.
after: best se in the tree preempts current.

hackbench -g 12 -l 1000000000 & (480 tasks, 2x of the CPUs)

cyclictest --mlockall -D 1m -q
before:
T: 0 (15983) P: 0 I:1000 C:  43054 Min:     11 Act:  144 Avg:  627 Max:   11446

after:
T: 0 (16473) P: 0 I:1000 C:  49822 Min:      7 Act:  160 Avg:  388 Max:   10190

Min, Avg, Max latency all decreased.

thanks,
Chenyu

  reply	other threads:[~2024-05-25 11:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 13:40 [PATCH] sched/fair: Reschedule the cfs_rq when current is ineligible Chunxin Zang
2024-05-24 15:30 ` Chen Yu
2024-05-28  2:42   ` Chunxin Zang
2024-05-28  5:02     ` K Prateek Nayak
2024-05-28  7:18       ` Chunxin Zang
2024-05-28  7:47         ` K Prateek Nayak
2024-06-05 17:19       ` Chen Yu
2024-06-06  1:46         ` Chunxin Zang
2024-06-07  2:38           ` Chen Yu
2024-06-11 13:10             ` Chunxin Zang
2024-06-13 11:45               ` Chen Yu
2024-05-28  6:41     ` Chunxin Zang
2024-05-25  6:41 ` Mike Galbraith
2024-05-25 11:57   ` Chen Yu [this message]
2024-05-25 17:22     ` Mike Galbraith
2024-05-27  8:05   ` Peter Zijlstra
2024-05-27  9:53     ` Mike Galbraith
2024-05-25 11:48 ` Honglei Wang
     [not found]   ` <6AF97701-B8F4-46C6-851E-A8BACE97E8C0@gmail.com>
2024-06-03  2:55     ` Honglei Wang
2024-06-06 12:39       ` Chunxin Zang
2024-06-11 11:39         ` Honglei Wang
2024-05-29  6:06 ` kernel test robot

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=ZlHSNXe0c5/sx9D9@chenyu5-mobl2 \
    --to=yu.c.chen@intel.com \
    --cc=bristot@redhat.com \
    --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@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=spring.cxz@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yangchen11@lixiang.com \
    --cc=zangchunxin@lixiang.com \
    --cc=zhouchunhua@lixiang.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