From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753247AbdKXK07 (ORCPT ); Fri, 24 Nov 2017 05:26:59 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36227 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752387AbdKXK04 (ORCPT ); Fri, 24 Nov 2017 05:26:56 -0500 X-Google-Smtp-Source: AGs4zMaI3Ohsjn/eRAPn6praCOLoEBp1JEJE05TdiFjnMi5EjHx9ulQ0CAIUPinsqkMW1NoT1fQakg== From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Fri, 24 Nov 2017 11:26:36 +0100 To: Mike Galbraith Cc: Uladzislau Rezki , Atish Patra , Peter Zijlstra , Joel Fernandes , LKML , Brendan Jackman , Josef Bacik , Ingo Molnar Subject: Re: [PATCH RFC 1/2] sched: Minimize the idle cpu selection race window. Message-ID: <20171124102636.zqqjqa3sru7ebh4k@pc636> References: <1509427662-25114-1-git-send-email-atish.patra@oracle.com> <1509427662-25114-2-git-send-email-atish.patra@oracle.com> <20171031082009.rxxa57goto6q5xld@hirez.programming.kicks-ass.net> <49e98b00-80c7-b3a4-30fd-bccb382d002b@oracle.com> <20171123105247.wcl2fiypge2pvile@pc636> <1511442781.6505.26.camel@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1511442781.6505.26.camel@gmx.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 23, 2017 at 02:13:01PM +0100, Mike Galbraith wrote: > On Thu, 2017-11-23 at 11:52 +0100, Uladzislau Rezki wrote: > > Hello, Atish, Peter, all. > > > > I have a question about if a task's nr_cpus_allowed is 1. > > In that scenario we do not call select_task_rq. Therefore > > even thought a task "p" is placed on idle CPU that CPU > > will not be marked as claimed for wake-up. > > > > What do you think about adding per_cpu(claim_wakeup, cpu) = 1; > > to select_task_rq() instead and possibly get rid of them from > > other places (increases a race window a bit)? > > My thoughts on all of this is that we need less SIS, not more.  Rather > than trying so hard for the absolute lowest wakeup latency, which > induces throughput/efficiency robbing bouncing, I think we'd be better > of considering leaving an already llc affine task where it is if the > average cycle time is sufficiently low that it will likely hit the CPU > RSN. 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. - Get rid of duplication; - Be not limited to pinned case. If you have any proposal, i would be appreciated if you could share your specific view. > Completely ignoring low utilization kernel threads would go a > long way to getting rid of bouncing userspace (which tends to have a > meaningful footprint), all over hell and creation. > > You could also periodically send mobile kthreads down the slow path to > try to keep them the hell away from partially busy CPUs, as well as > anything else that hasn't run for a while, to keep background cruft > from continually injecting itself into the middle of a cross core > cyber-sex. CPU is not considered idle (in terms of idle_cpu()) until it hits a first rule checking a condition if current is idle thread or not. If we hit last check when a claim wake-up is set it means that CPU switches from idle state to non-idle one and it will happen quite soon depending on wake-up latency. 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. -- Uladzislau Rezki