From: Chen Yu <yu.c.chen@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Tim Chen <tim.c.chen@intel.com>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Abel Wu <wuyun.abel@bytedance.com>,
Yicong Yang <yangyicong@hisilicon.com>,
"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
Honglei Wang <wanghonglei@didichuxing.com>,
Len Brown <len.brown@intel.com>, Chen Yu <yu.chen.surf@gmail.com>,
Tianchen Ding <dtcccc@linux.alibaba.com>,
"Joel Fernandes" <joel@joelfernandes.org>,
Josh Don <joshdon@google.com>, "Hillf Danton" <hdanton@sina.com>,
kernel test robot <yujie.liu@intel.com>,
"Arjan Van De Ven" <arjan.van.de.ven@intel.com>,
Aaron Lu <aaron.lu@intel.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 2/2] sched/fair: Introduce SIS_CURRENT to wake up short task on current CPU
Date: Thu, 27 Apr 2023 15:57:05 +0800 [thread overview]
Message-ID: <ZEoq0UXokdPG7i3n@chenyu5-mobl1> (raw)
In-Reply-To: <20230426140324.GB1377058@hirez.programming.kicks-ass.net>
On 2023-04-26 at 16:03:24 +0200, Peter Zijlstra wrote:
> On Sat, Apr 22, 2023 at 12:08:18AM +0800, Chen Yu wrote:
>
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 4af5799b90fc..46c1321c0407 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -6501,6 +6501,46 @@ static int wake_wide(struct task_struct *p)
> > return 1;
> > }
> >
> > +/*
> > + * Wake up the task on current CPU, if the following conditions are met:
> > + *
> > + * 1. waker A is the only running task on this_cpu
> > + * 3. A is a short duration task (waker will fall asleep soon)
> > + * 4. wakee B is a short duration task (impact of B on A is minor)
> > + * 5. A and B wake up each other alternately
> > + */
> > +static bool
> > +wake_on_current(int this_cpu, struct task_struct *p)
> > +{
> > + if (!sched_feat(SIS_CURRENT))
> > + return false;
> > +
> > + if (cpu_rq(this_cpu)->nr_running > 1)
> > + return false;
> > +
> > + /*
> > + * If a task switches in and then voluntarily relinquishes the
> > + * CPU quickly, it is regarded as a short duration task. In that
> > + * way, the short waker is likely to relinquish the CPU soon, which
> > + * provides room for the wakee. Meanwhile, a short wakee would bring
> > + * minor impact to the target rq. Put the short waker and wakee together
> > + * bring benefit to cache-share task pairs and avoid migration overhead.
> > + */
> > + if (!current->se.dur_avg || ((current->se.dur_avg * 8) >= sysctl_sched_min_granularity))
> > + return false;
> > +
> > + if (!p->se.dur_avg || ((p->se.dur_avg * 8) >= sysctl_sched_min_granularity))
> > + return false;
> > +
> > + if (current->wakee_flips || p->wakee_flips)
> > + return false;
> > +
> > + if (current->last_wakee != p || p->last_wakee != current)
> > + return false;
> > +
> > + return true;
> > +}
>
> So I was going to play with this and found I needed to change things up
> since these sysctl's no longer exist in my EEVDF branch.
>
> And while I can easily do
> 's/sysctl_sched_min_granularity/sysctl_sched_base_slice/', it did make
> me wonder if that's the right value to use.
>
> min_gran/base_slice is related to how long we want a task to run before
> switching, but that is not related to how long it needs to run to
> establish a cache footprint.
>
> Would not sched_migration_cost be a better measure to compare against?
> That is also used in task_hot() to prevent migrations.
Yes, thanks for the suggestion, this looks more reasonable. I'll tune on this
and check the result.
thanks,
Chenyu
next prev parent reply other threads:[~2023-04-27 7:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 16:06 [PATCH v7 0/2] " Chen Yu
2023-04-21 16:07 ` [PATCH v7 1/2] sched/fair: Record the average duration of a task Chen Yu
2023-04-21 16:08 ` [PATCH v7 2/2] sched/fair: Introduce SIS_CURRENT to wake up short task on current CPU Chen Yu
2023-04-26 14:03 ` Peter Zijlstra
2023-04-27 7:57 ` Chen Yu [this message]
2023-04-24 6:59 ` [PATCH v7 0/2] " 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=ZEoq0UXokdPG7i3n@chenyu5-mobl1 \
--to=yu.c.chen@intel.com \
--cc=aaron.lu@intel.com \
--cc=arjan.van.de.ven@intel.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=dtcccc@linux.alibaba.com \
--cc=gautham.shenoy@amd.com \
--cc=hdanton@sina.com \
--cc=joel@joelfernandes.org \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@intel.com \
--cc=vincent.guittot@linaro.org \
--cc=wanghonglei@didichuxing.com \
--cc=wuyun.abel@bytedance.com \
--cc=yangyicong@hisilicon.com \
--cc=yu.chen.surf@gmail.com \
--cc=yujie.liu@intel.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®