mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Mike Galbraith <efault@gmx.de>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	Atish Patra <atish.patra@oracle.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Joel Fernandes <joelaf@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Brendan Jackman <brendan.jackman@arm.com>,
	Josef Bacik <jbacik@fb.com>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH RFC 1/2] sched: Minimize the idle cpu selection race window.
Date: Tue, 28 Nov 2017 10:34:22 +0100	[thread overview]
Message-ID: <20171128093422.5hmrkonj3z6twy2y@pc636> (raw)
In-Reply-To: <1511549190.8029.233.camel@gmx.de>

On Fri, Nov 24, 2017 at 07:46:30PM +0100, Mike Galbraith wrote:
> On Fri, 2017-11-24 at 11:26 +0100, Uladzislau Rezki wrote:
> > 
> > I guess there is misunderstanding here. The main goal is not to cover
> > pinned case, for sure. I was thinking more about below points:
> > 
> > - Extend a claim_wake_up logic for making an ILB/NO_HZ decision more
> >   predictable (that is good for mobile workloads). Because as it is
> >   right now it simply returns a first CPU in a "nohz" mask and if we
> >   know that CPU has been claimed i think it is worth to go with another
> >   ILB core, since waking up on a remote CPU + doing nohz_idle_balance
> >   does not improve wake-up latency and is a miss from ilb point of view.
> 
> Using unsynchronized access of a flag set by chaotic events all over
> the box?
Well, entering NO_HZ mode and checking nohz.idle_cpus_mask
nohz_balancer_kick() -> find_new_ilb() are obviously asynchronous
events and like you say is chaotic except of accessing to the
cpumask variable (i mean atomically). So do not see any issues
with that.

> 
> > If you have any proposal, i would be appreciated if you could
> > share your specific view.
> 
> My view is you're barking up the wrong tree: you're making the idle
> data SIS is using more accurate, but I question the benefit.  That it
> makes an imperfect placement decision occasionally due to raciness is
> nearly meaningless compared to the cost of frequent bounce.
Before sitting down and start testing, i just illustrated how we can
apply claim_wake_up to ilb asking community a specific view on it:
drawbacks, pros/cons, proposals etc.

>
> Better (but still not perfect, that requires atomics) state information
> doesn't meaningfully improve decision quality.
> 
I agree, it should be atomic, something like below:

core.c
+/* cpus with claim wake-up set bit */
+cpumask_t cpu_claim_wake_up_map;
...
@@ -1559,6 +1562,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)
                     !cpu_online(cpu)))
                cpu = select_fallback_rq(task_cpu(p), p);

+       cpumask_test_and_set_cpu(cpu, &cpu_claim_wake_up_map);
        return cpu;
}
...
+       if (cpumask_test_cpu(cpu, &cpu_claim_wake_up_map))
+               return 0;
+
        return 1;
}

fair.c:
static inline int find_new_ilb(void)
{
-       int ilb = cpumask_first(nohz.idle_cpus_mask);
+       cpumask_t cpumask;
+       int ilb;
+
+       cpumask_andnot(&cpumask, nohz.idle_cpus_mask,
+                       &cpu_claim_wake_up_map);
+
+       ilb = cpumask_first(&cpumask);

> > Considering a core as not-idle when somebody tends to wake up a task on
> > it is a good point. If you have any specific example when it is bad,
> > please share it.
> 
> I'm not sure how that will work out.  Probably like most everything wrt
> SIS, first comes "woohoo" then "aw crap", and off to the trash it goes.
> 

--
Uladzislau Rezki

  parent reply	other threads:[~2017-11-28  9:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31  5:27 [PATCH RFC 0/2] Fix race window during idle cpu selection Atish Patra
2017-10-31  5:27 ` [PATCH RFC 1/2] sched: Minimize the idle cpu selection race window Atish Patra
2017-10-31  8:20   ` Peter Zijlstra
2017-10-31  8:48     ` Mike Galbraith
2017-11-01  6:08       ` Atish Patra
2017-11-01  6:54         ` Mike Galbraith
2017-11-01  7:18           ` Mike Galbraith
2017-11-01 16:36             ` Atish Patra
2017-11-01 20:20               ` Mike Galbraith
2017-11-05  0:58     ` Joel Fernandes
2017-11-22  5:23       ` Atish Patra
2017-11-23 10:52         ` Uladzislau Rezki
2017-11-23 13:13           ` Mike Galbraith
2017-11-23 16:00             ` Josef Bacik
2017-11-23 17:40               ` Mike Galbraith
2017-11-23 21:11               ` Atish Patra
2017-11-24 10:26             ` Uladzislau Rezki
2017-11-24 18:46               ` Mike Galbraith
2017-11-26 20:58                 ` Mike Galbraith
2017-11-28  9:34                 ` Uladzislau Rezki [this message]
2017-11-28 10:49                   ` Mike Galbraith
2017-11-29 10:41                     ` Uladzislau Rezki
2017-11-29 18:15                       ` Mike Galbraith
2017-11-30 12:30                         ` Uladzislau Rezki
2017-10-31  5:27 ` [PATCH DEBUG 2/2] sched: Add a stat for " Atish Patra

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=20171128093422.5hmrkonj3z6twy2y@pc636 \
    --to=urezki@gmail.com \
    --cc=atish.patra@oracle.com \
    --cc=brendan.jackman@arm.com \
    --cc=efault@gmx.de \
    --cc=jbacik@fb.com \
    --cc=joelaf@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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®