[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAERHkrvU0nay-cG9equdOBejOZ5Ffdxo+67ZRp9q0L9BQkcAtQ@mail.gmail.com>
Date: Wed, 8 May 2019 23:49:58 +0800
From: Aubrey Li <aubrey.intel@...il.com>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: Aaron Lu <aaron.lu@...ux.alibaba.com>,
Vineeth Remanan Pillai <vpillai@...italocean.com>,
Nishanth Aravamudan <naravamudan@...italocean.com>,
Julien Desfossez <jdesfossez@...italocean.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Paul Turner <pjt@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Subhra Mazumdar <subhra.mazumdar@...cle.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
Kees Cook <keescook@...omium.org>,
Greg Kerr <kerrnel@...gle.com>, Phil Auld <pauld@...hat.com>,
Aaron Lu <aaron.lwe@...il.com>,
Valentin Schneider <valentin.schneider@....com>,
Mel Gorman <mgorman@...hsingularity.net>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [RFC PATCH v2 11/17] sched: Basic tracking of matching tasks
On Fri, May 3, 2019 at 8:06 AM Tim Chen <tim.c.chen@...ux.intel.com> wrote:
>
> On 5/1/19 4:27 PM, Tim Chen wrote:
> > On 4/28/19 11:15 PM, Aaron Lu wrote:
> >> On Tue, Apr 23, 2019 at 04:18:16PM +0000, Vineeth Remanan Pillai wrote:
> >>> +/*
> >>> + * Find left-most (aka, highest priority) task matching @cookie.
> >>> + */
> >>> +struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
> >>> +{
> >>> + struct rb_node *node = rq->core_tree.rb_node;
> >>> + struct task_struct *node_task, *match;
> >>> +
> >>> + /*
> >>> + * The idle task always matches any cookie!
> >>> + */
> >>> + match = idle_sched_class.pick_task(rq);
> >>> +
> >>> + while (node) {
> >>> + node_task = container_of(node, struct task_struct, core_node);
> >>> +
> >>> + if (node_task->core_cookie < cookie) {
> >>> + node = node->rb_left;
> >>
> >> Should go right here?
> >>
> >
> > I think Aaron is correct. We order the rb tree where tasks with smaller core cookies
> > go to the left part of the tree.
> >
> > In this case, the cookie we are looking for is larger than the current node's cookie.
> > It seems like we should move to the right to look for a node with matching cookie.
> >
> > At least making the following change still allow us to run the system stably for sysbench.
> > Need to gather more data to see how performance changes.
>
> Pawan ran an experiment setting up 2 VMs, with one VM doing a parallel kernel build and one VM doing sysbench,
> limiting both VMs to run on 16 cpu threads (8 physical cores), with 8 vcpu for each VM.
> Making the fix did improve kernel build time by 7%.
I'm gonna agree with the patch below, but just wonder if the testing
result is consistent,
as I didn't see any improvement in my testing environment.
IIUC, from the code behavior, especially for 2 VMs case(only 2
different cookies), the
per-rq rb tree unlikely has nodes with different cookies, that is, all
the nodes on this
tree should have the same cookie, so:
- if the parameter cookie is equal to the rb tree cookie, we meet a
match and go the
third branch
- else, no matter we go left or right, we can't find a match, and
we'll return idle thread
finally.
Please correct me if I was wrong.
Thanks,
-Aubrey
>
> Tim
>
>
> >
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 25638a47c408..ed4cfa49e3f2 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -208,9 +208,9 @@ static struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
> > while (node) {
> > node_task = container_of(node, struct task_struct, core_node);
> >
> > - if (node_task->core_cookie < cookie) {
> > + if (cookie < node_task->core_cookie) {
> > node = node->rb_left;
> > - } else if (node_task->core_cookie > cookie) {
> > + } else if (cookie > node_task->core_cookie) {
> > node = node->rb_right;
> > } else {
> > match = node_task;
> >
> >
>
Powered by blists - more mailing lists