Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1870348ybb; Thu, 9 Apr 2020 10:31:35 -0700 (PDT) X-Google-Smtp-Source: APiQypKv12vvfaW8x38BAIQQMeCZHpy1G/Kvkcm1Gq1RUN1DKON5B2TSS4dH5XI6DLT+usiVjXms X-Received: by 2002:ad4:4c85:: with SMTP id bs5mr1218344qvb.212.1586453495623; Thu, 09 Apr 2020 10:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586453495; cv=none; d=google.com; s=arc-20160816; b=DhM5KtplapNkjMLPZZljgec2THp8zexKNIpxMRjbaBiFIfPBs1FqJP/mbTZsdxnqOJ ePzq/B+MII6XZ+/DM1uDGEaGGzh/aDNT8NuXmMEUyqJkhldL2cjhg6W1TS7OlwRsvBbW qE+CfhpllD/FMEb7GfKxl7OSyBnNddaC7rM22ulMKaXPR9V/d1R5VaUl2KNjQQQm0hr4 z06jWILFvRGhHiETsAqiSF/Il2gBhxyRgChxmZYKL6LSwhMYkKSlVU5s9vZ/t881PPw3 gpLaU3IQBszQlzUsqjmtt+n7SMcdp0h1edf/7viWCQdM9kZ1eXEd0e9qRZw+7ANdJ3mO xB3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=h2lvFGTEAMcYqpPDxpo0q1r6MbOT4nJeYnIJOw9UCwY=; b=xPu+Mq5Dmw9iT95WRmmMR2F83q/wgy47AmknSv/4RunaR5TBXKcO/GtIfJ4ZlC17nz aMSJXzAje7zQxWdokZXEja0L1Li+RcebLDQYpQXEhH4kMBBvFfAOlis4o97NDB5E5btY Mfn5zCefJVy/EUByDmEEUCel3ILf8jmhCMTLV4VYNk75DAXTYOz83gmG186Ff1YSo6Gx slrDrM/ppCFF15pRwjCo5k0E4PvSjtcRpRHiC31BlJG2gI4uKgnpEMQOVYBu7/+h7vZs zSBtgJSipT4PR4Fcjz0o80FwNV4koFyyRVKVNQjq3ErscIzc4lBQUheRkJuTCZasc9pr mFsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m129si6171703qke.230.2020.04.09.10.31.20; Thu, 09 Apr 2020 10:31:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbgDIR3u (ORCPT + 99 others); Thu, 9 Apr 2020 13:29:50 -0400 Received: from foss.arm.com ([217.140.110.172]:52786 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbgDIR3t (ORCPT ); Thu, 9 Apr 2020 13:29:49 -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 E390B31B; Thu, 9 Apr 2020 10:29:49 -0700 (PDT) Received: from [192.168.1.19] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C1E13F73D; Thu, 9 Apr 2020 10:29:47 -0700 (PDT) Subject: Re: [PATCH 2/4] sched/deadline: Improve admission control for asymmetric CPU capacities To: Valentin Schneider , luca abeni Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Qais Yousef , linux-kernel@vger.kernel.org References: <20200408095012.3819-1-dietmar.eggemann@arm.com> <20200408095012.3819-3-dietmar.eggemann@arm.com> <20200408153032.447e098d@nowhere> From: Dietmar Eggemann Message-ID: <31620965-e1e7-6854-ad46-8192ee4b41af@arm.com> Date: Thu, 9 Apr 2020 19:29:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.04.20 17:01, Valentin Schneider wrote: > > On 08/04/20 14:30, luca abeni wrote: >>> >>> I don't think this is strictly equivalent to what we have now for the >>> SMP case. 'cpus' used to come from dl_bw_cpus(), which is an ugly way >>> of writing >>> >>> cpumask_weight(rd->span AND cpu_active_mask); >>> >>> The rd->cpu_capacity_orig field you added gets set once per domain >>> rebuild, so it also happens in sched_cpu_(de)activate() but is >>> separate from touching cpu_active_mask. AFAICT this mean we can >>> observe a CPU as !active but still see its capacity_orig accounted in >>> a root_domain. >> >> Sorry, I suspect this is my fault, because the bug comes from my >> original patch. >> When I wrote the original code, I believed that when a CPU is >> deactivated it is also removed from its root domain. >> >> I now see that I was wrong. >> > > Well it is indeed the case, but sadly it's not an atomic step - AFAICT with > cpusets we do hold some cpuset lock when calling __dl_overflow() and when > rebuilding the domains, but not when fiddling with the active mask. > > I just realized it's even more obvious for dl_cpu_busy(): IIUC it is meant > to prevent the removal of a CPU if it would lead to a DL overflow - it > works now because the active mask is modified before it gets called, but > here it breaks because it's called before the sched_domain rebuild. > > Perhaps re-computing the root domain capacity sum at every dl_bw_cpus() > call would be simpler. It's a bit more work, but then we already have a > for_each_cpu_*() loop, and we only rely on the masks being correct. Maybe we can do a hybrid. We have rd->span and rd->sum_cpu_capacity and with the help of an extra per-cpu cpumask we could just DEFINE_PER_CPU(cpumask_var_t, dl_bw_mask); dl_bw_cpus(int i) { struct cpumask *cpus = this_cpu_cpumask_var_ptr(dl_bw_mask); ... cpumask_and(cpus, rd->span, cpu_active_mask); return cpumask_weight(cpus); } and dl_bw_capacity(int i) { struct cpumask *cpus = this_cpu_cpumask_var_ptr(dl_bw_mask); ... cpumask_and(cpus, rd->span, cpu_active_mask); if (cpumask_equal(cpus, rd->span)) return rd->sum_cpu_capacity; for_each_cpu(i, cpus) cap += capacity_orig_of(i); return cap; } So only in cases in which rd->span and cpu_active_mask differ we would have to sum up again.