From: Uladzislau Rezki <urezki@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>, Mike Galbraith <efault@gmx.de>,
Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>,
Paul Turner <pjt@google.com>, Oleg Nesterov <oleg@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
Kirill Tkhai <tkhai@yandex.ru>,
Tim Chen <tim.c.chen@linux.intel.com>,
Nicolas Pitre <nicolas.pitre@linaro.org>
Subject: Re: [RFC v1] sched/fair: search a task from the tail of the queue
Date: Mon, 18 Sep 2017 09:53:33 +0200 [thread overview]
Message-ID: <20170918075331.titxxkm3kuzqx3oy@pc636> (raw)
In-Reply-To: <20170828084155.3mopma55cdikqqcc@hirez.programming.kicks-ass.net>
On Mon, Aug 28, 2017 at 10:41:55AM +0200, Peter Zijlstra wrote:
> On Fri, Aug 25, 2017 at 12:11:31AM +0200, Uladzislau Rezki (Sony) wrote:
> > From: Uladzislau Rezki <urezki@gmail.com>
> >
> > As a first step this patch makes cfs_tasks list as MRU one.
> > It means, that when a next task is picked to run on physical
> > CPU it is moved to the front of the list.
> >
> > Thefore, the cfs_tasks list is more or less sorted (except woken
> > tasks) starting from recently given CPU time tasks toward tasks
> > with max wait time in a run-queue, i.e. MRU list.
> >
> > Second, as part of the load balance operation, this approach
> > starts detach_tasks()/detach_one_task() from the tail of the
> > queue instead of the head, giving some advantages:
> >
> > - tends to pick a task with highest wait time;
> > - tasks located in the tail are less likely cache-hot,
> > therefore the can_migrate_task() decision is higher.
> >
> > hackbench illustrates slightly better performance. For example
> > doing 1000 samples and 40 groups on i5-3320M CPU, it shows below
> > figures:
> >
> > default: 0.644 avg
> > patched: 0.637 avg
> >
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > ---
> > kernel/sched/fair.c | 19 ++++++++++++++-----
> > 1 file changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index c77e4b1d51c0..cda281c6bb29 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -6357,7 +6357,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
> > if (hrtick_enabled(rq))
> > hrtick_start_fair(rq, p);
> >
> > - return p;
> > + goto done;
> > simple:
> > cfs_rq = &rq->cfs;
> > #endif
> > @@ -6378,6 +6378,14 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
> > if (hrtick_enabled(rq))
> > hrtick_start_fair(rq, p);
> >
> > +done: __maybe_unused
> > + /*
> > + * Move the next running task to the front of
> > + * the list, so our cfs_tasks list becomes MRU
> > + * one.
> > + */
> > + list_move(&se->group_node, &rq->cfs_tasks);
> > +
> > return p;
> >
> > idle:
>
> Could you also run something like:
>
> $ taskset 1 perf bench sched pipe
>
> to make sure the added list_move() doesn't hurt, I'm not sure group_node
> and cfs_tasks are in cachelines we already touch for that operation.
>
> And if you can see that list_move() hurt in "perf annotate", try moving
> those members around to lines that we already need anyway.
@Peter: just in case if you missed my email. I uploaded one more patch
provided where i provided latest result as well. Please have a look
at following links:
https://lkml.org/lkml/2017/9/13/167
https://lkml.org/lkml/2017/9/13/168
Best Regards,
Uladzislau Rezki
prev parent reply other threads:[~2017-09-18 7:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 22:11 Uladzislau Rezki (Sony)
2017-08-28 8:41 ` Peter Zijlstra
2017-08-30 6:04 ` Uladzislau Rezki
2017-09-18 7:53 ` Uladzislau Rezki [this message]
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=20170918075331.titxxkm3kuzqx3oy@pc636 \
--to=urezki@gmail.com \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nicolas.pitre@linaro.org \
--cc=oleg@redhat.com \
--cc=oleksiy.avramchenko@sonymobile.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@linux.intel.com \
--cc=tkhai@yandex.ru \
--cc=umgwanakikbuti@gmail.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®