Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp781116imu; Tue, 20 Nov 2018 06:55:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/XEKXX6N8ZWfsc/XTMfKLkN+6N9EyMDCKVeseuelI/WYtdBI7EN4mYjsMY3ljVXf0mPx4PP X-Received: by 2002:a17:902:6907:: with SMTP id j7mr2441595plk.221.1542725731779; Tue, 20 Nov 2018 06:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542725731; cv=none; d=google.com; s=arc-20160816; b=L+98A1EYNqNe3FXos7VRM/i5YtyOKd3F8NMMa+9qUR4MgBfwZ5uyht/8aibvkJFC94 fHcQpjQ7G92YVeCLHuuLDDk7cB5mSwGY9cpFl631ao3mHIy+qc7pO9ZJEFVYbQj2F1Bu B35tDv3R0GG8TOMFE8nhPEX1L9pSFdso93fyxqBO+AMsWYQEfIQLFO8HZPo/8i/udnwA ymGMv06fGvVhw+cfxEzUXj3cMUepKurXm0rw1pC4G0zc8trSCOc4SmNA/1IArk+NLhsH EDiip4r1e/McDlN9KMgSOU5bgFfLYoSJYCQBBUxYj8hvHT5mYFM+v4PgE/rdvo4SL11V fMuQ== 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=I9H7RId3oHSU/zopwsZolbn1KGBeDS88tKjupnkgdfQ=; b=XL9Pbm/AjsZJ9Jpbke/hB5Wmh8jbT6/aEeTgtudm+7b94+UZjPiHM7JBgOy/pfj3nS SowrAH9zqnKJRhZoiF/VVEqGiq2ZmEOACw/j1rdwPEVo4d4Uwqbq+TwLWuDV+bfx5orQ BBcngcP22MtgZgYDFhbnlUzsioUV3A4kaS2Pg4LVGfzLWaXS13IvxLpG0sBi3aWe1Fsx zrMX/7kcMU8XwPLC2GSkqWm+yT8/oA2TuxVQr0TuxujHgjK7OzDelD82DQNOMWafQA4s 33XUJcSo/gCfljRK9H5ElM4Qy3JrEOwx2VsB5QF+HlCafefaChMbiWbLX14wuzJDyiRS uLJg== 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 y141si21509843pfc.180.2018.11.20.06.55.17; Tue, 20 Nov 2018 06:55:31 -0800 (PST) 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 S1727070AbeKTXLj (ORCPT + 99 others); Tue, 20 Nov 2018 18:11:39 -0500 Received: from foss.arm.com ([217.140.101.70]:48294 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbeKTXLj (ORCPT ); Tue, 20 Nov 2018 18:11:39 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9EB7C80D; Tue, 20 Nov 2018 04:42:41 -0800 (PST) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F3D53F5B7; Tue, 20 Nov 2018 04:42:39 -0800 (PST) Subject: Re: [PATCH v3 03/10] sched/topology: Provide cfs_overload_cpus bitmap To: Steven Sistare , mingo@redhat.com, peterz@infradead.org Cc: subhra.mazumdar@oracle.com, dhaval.giani@oracle.com, daniel.m.jordan@oracle.com, pavel.tatashin@microsoft.com, matt@codeblueprint.co.uk, umgwanakikbuti@gmail.com, riel@redhat.com, jbacik@fb.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, quentin.perret@arm.com, linux-kernel@vger.kernel.org References: <1541767840-93588-1-git-send-email-steven.sistare@oracle.com> <1541767840-93588-4-git-send-email-steven.sistare@oracle.com> <0857925d-a24e-90ea-e28c-90d69b2f66dd@oracle.com> From: Valentin Schneider Message-ID: <7d9b6789-af17-bcab-e52d-7e05483e10ea@arm.com> Date: Tue, 20 Nov 2018 12:42:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <0857925d-a24e-90ea-e28c-90d69b2f66dd@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/11/2018 17:33, Steven Sistare wrote: [...] >> >> Thinking about misfit stealing, we can't use the sd_llc_shared's because >> on big.LITTLE misfit migrations happen across LLC domains. >> >> I was thinking of adding a misfit sparsemask to the root_domain, but >> then I thought we could do the same thing for cfs_overload_cpus. >> >> By doing so we'd have a single source of information for overloaded CPUs, >> and we could filter that down during idle balance - you mentioned earlier >> wanting to try stealing at each SD level. This would also let you get >> rid of [PATCH 02]. >> >> The main part of try_steal() could then be written down as something like >> this: >> >> ----->8----- >> >> for_each_domain(this_cpu, sd) { >> span = sched_domain_span(sd) >> >> for_each_sparse_wrap(src_cpu, overload_cpus) { >> if (cpumask_test_cpu(src_cpu, span) && >> steal_from(dts_rq, dst_rf, &locked, src_cpu)) { >> stolen = 1; >> goto out; >> } >> } >> } >> >> ------8<----- >> >> We could limit the stealing to stop at the highest SD_SHARE_PKG_RESOURCES >> domain for now so there would be no behavioural change - but we'd >> factorize the #ifdef SCHED_SMT bit. Furthermore, the door would be open >> to further stealing. >> >> What do you think? > > That is not efficient for a multi-level search because at each domain level we > would (re) iterate over overloaded candidates that do not belong in that level. Mmm I was thinking we could abuse the wrap() and start at (fls(prev_span) + 1), but we're not guaranteed to have contiguous spans - the Arm Juno for instance has [0, 3, 4], [1, 2] as MC-level domains, so that goes down the drain. Another thing that has been trotting in my head would be some helper to create a cpumask from a sparsemask (some sort of sparsemask_span()), which would let us use the standard mask operators: ----->8----- struct cpumask *overload_span = sparsemask_span(overload_cpus) for_each_domain(this_cpu, sd) for_each_cpu_and(src_cpu, overload_span, sched_domain_span(sd)) -----8>----- The cpumask could be part of the sparsemask struct to save us the allocation, and only updated when calling sparsemask_span(). > To extend stealing across LLC, I would like to keep the per-LLC sparsemask, > but add to each SD a list of sparsemask pointers. The list nodes would be > private, but the sparsemask structs would be shared. Each list would include > the masks that overlap the SD's members. The list would be a singleton at the > core and LLC levels (same as the socket level for most processors), and would > have multiple elements at the NUMA level. > I see. As for misfit, creating asym_cpucapacity siblings of the sd_llc_*() functions seems a bit much - there'd be a lot of redundancy for basically just a single shared sparsemask, which is why I was rambling about moving things to root_domain. Having different locations where sparsemasks are stored is a bit of a pain which I'd like to avoid, but if it can't be unified I suppose we'll have to live with it. > - Steve >