Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1613354ybt; Thu, 2 Jul 2020 09:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ6jeaaVZGBoyHHY/C7m8vQX70oE/UQxpharmEaPQXJGQQVRKsBYjdmaWNRE4NgpjOwkkv X-Received: by 2002:a50:fd07:: with SMTP id i7mr1629084eds.221.1593707291943; Thu, 02 Jul 2020 09:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593707291; cv=none; d=google.com; s=arc-20160816; b=cHGp0farE+2li1CtcgtmIJDoIVDb5V5CQE62dpOdmi/19W3ygJjfjwm0aZNdbJONje oLnG24tesl6ffwcOYzSiRoTS68vVtvGiOLgGGknjJ05vBDiBNzLMWdv8mxlhgKj2WeIu yTgR1rDtpPB2ViIUlx/RVEHNZOI5KesWbqHTRCliO09lyNe8pCuQ+agKYwUkGwBUKOMS G4FEeefGK1OkiJjXDbxtHlRMof8FFjUVxKbifWm+Qs6UtQOAV+1A+lGcpp9i8aSlAECb APfGC5bzPcRrQmmu+lGdd/UREWXQg74b1zJ3QatbDgdzVK8Gep9S0UVxTNr/1px1jZJT 4Ovw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=6Zs39Jo6KLXZpSNEXhYg4mv3BeAm2ZmlBID+VEN1dD4=; b=0hdKxnObD2o6jmzuQlJceZsFNYtVIwEt4SJW+etmD/da5Mnye7c4fzmoqltIjWCUmW +zfVt6WNl1qm9Tv9/ntqq/+5o13+elxgrmcqO6ESniuTp6gjkk1gi8f+BiAWChQCMKCQ IJiqXU3jr5MUGEMRKWDzp8zi29J98EItY7tLwTbJXKoOhmLTaceGz+oASN1MY09CAeli +fnf9wT5+KnFiz9QNVUeVnNwglM/jN2lh4/Mf0OGCqasBUjAejUbcxPqrTLJFOYfNseR MeRhzKDUtCngYX3PolmvagoGFUE5xjX4aLbMLuYbPfigjJpeqHPUeZz9bI6HqV2zkGkN MEcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si6771627edn.385.2020.07.02.09.27.47; Thu, 02 Jul 2020 09:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbgGBQZs (ORCPT + 99 others); Thu, 2 Jul 2020 12:25:48 -0400 Received: from foss.arm.com ([217.140.110.172]:40712 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726148AbgGBQZs (ORCPT ); Thu, 2 Jul 2020 12:25:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E17621FB; Thu, 2 Jul 2020 09:25:47 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E07CC3F71E; Thu, 2 Jul 2020 09:25:46 -0700 (PDT) References: <20200701190656.10126-1-valentin.schneider@arm.com> <20200701190656.10126-3-valentin.schneider@arm.com> <20200702121536.GA765585@google.com> <20200702154514.GA1072702@google.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Quentin Perret Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, morten.rasmussen@arm.com Subject: Re: [PATCH v3 2/7] sched/topology: Define and assign sched_domain flag metadata In-reply-to: <20200702154514.GA1072702@google.com> Date: Thu, 02 Jul 2020 17:25:41 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/07/20 16:45, Quentin Perret wrote: > On Thursday 02 Jul 2020 at 15:31:07 (+0100), Valentin Schneider wrote: >> There an "interesting" quirk of asym_cpu_capacity_level() in that it does >> something slightly different than what it says on the tin: it detects >> the lowest topology level where *the biggest* CPU capacity is visible by >> all CPUs. That works just fine on big.LITTLE, but there are questionable >> DynamIQ topologies that could hit some issues. >> >> Consider: >> >> DIE [ ] >> MC [ ][ ] <- sd_asym_cpucapacity >> 0 1 2 3 4 5 >> L L B B B B >> >> asym_cpu_capacity_level() would pick MC as the asymmetric topology level, >> and you can argue either way: it should be DIE, because that's where CPUs 4 >> and 5 can see a LITTLE, or it should be MC, at least for CPUs 0-3 because >> there they see all CPU capacities. > > Right, I am not looking forward to these topologies... I'll try my best to prevent those from seeing the light of day, but you know how this works... >> Say there are two clusters in the system, one with a lone big CPU and the >> other with a mix of big and LITTLE CPUs: >> >> DIE [ ] >> MC [ ][ ] >> 0 1 2 3 4 >> L L B B B >> >> asym_cpu_capacity_level() will figure out that the MC level is the one >> where all CPUs can see a CPU of max capacity, and we will thus set >> SD_ASYM_CPUCAPACITY at MC level for all CPUs. >> >> That lone big CPU will degenerate its MC domain, since it would be alone in >> there, and will end up with just a DIE domain. Since the flag was only set >> at MC, this CPU ends up not seeing any SD with the flag set, which is >> broken. > > +1 > >> Rather than clearing dflags at every topology level, clear it before >> entering the topology level loop. This will properly propagate upwards >> flags that are set starting from a certain level. > > I'm feeling a bit nervous about that asymmetry -- in your example > select_idle_capacity() on, say, CPU3 will see less CPUs than on CPU4. > So, you might get fun side-effects where all task migrated to CPUs 0-3 > will be 'stuck' there while CPU 4 stays mostly idle. > It's actually pretty close to what happens with the LLC domain on SMP - select_idle_sibling() doesn't look outside of it. The wake_affine() stuff might steer the task towards a different LLC, but that's about it for wakeups. We rely on load balancing (fork/exec, newidle, nohz and periodic) to spread this further - and we would here too. It gets "funny" for EAS when we aren't overutilized and thus can't rely on load balancing; at least misfit ought to still work. It *is* a weird topology, for sure. > I have a few ideas to avoid that (e.g. looking at the rd span in > select_idle_capacity() instead of sd_asym_cpucapacity) but all this is > theoretical, so I'm happy to wait for a real platform to be released > before we worry too much about it. > > In the meantime: > > Reviewed-by: Quentin Perret Thanks!