Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp322544pxj; Thu, 27 May 2021 00:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoCABcpRIq200gbmOuTjxy83XaBJn2CBWtiAeWtW0eChl3s6OSqXoa6ES4XWu6UhR88Ro5 X-Received: by 2002:a02:6d09:: with SMTP id m9mr2182575jac.131.1622100923427; Thu, 27 May 2021 00:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622100923; cv=none; d=google.com; s=arc-20160816; b=s2V3U08F685sdwnKokhNS4RSNbFPcFAV6nxiMe91mQYiicBXV89e+TwxcIascrK6Mo hT2JpAuwkPtSfXc7AeImTZ2ngawOb51LuaY62d9QhmOQiesxtI3BxQpN0A5S+Tn9rxLQ 9i6dJnO+8t/yHBCYTM5BOAvU0rDZdwLkODUrs7aZharsmuH7+EGKqsvjbepfUqSX/nBb Zqk1EpRHfvNsULX2z7eEnORB0iBuBxHqOAD+2KGf9DTIK09fUWJSYsxznYzZMp8K0hki mVdGcKqH1ZGcrj9DtqcNoVQWFg2p5gslqlCQYvY8ULe/4RFTOroqviB9N8IfE4FbnoZZ nuqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=algR1xGAqGkW+cyqC0FjZ1B3MB1RsaFxY2Mhr0ENyvc=; b=1LtldlyX+GXuFIG30Y/o+j57QhTNQxAqm4EXxyWYirMiiGAYXS5PTRHM971M/QdWjd KOZtBLlDUFbjoGecIQH9MrXm0SXvU7r2F91wXUnHPqGbduPStn46iJZxCdtmHpnGmLJ7 o/uWNdBqN4PePGccoVLzpv8IahDHx8Nn9AarsiSTjFuj4w26YNFLmmqDqxxGb/Km4I5V D3FLENPzZTruWIDnrQ9K2jZTuunvegDrWFMiMsH3T3wLU5QKGgpZ3RIVJzkdjPP30Wv8 SoiCG2i82gC6xwSukQNcArcpxD8Ccwo7YRYVMvWpefq8Lx+x4JB70An2Fc9bTWgcBGXQ sZzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jgP2B028; 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 o2si1792298iov.96.2021.05.27.00.35.08; Thu, 27 May 2021 00:35:23 -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; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jgP2B028; 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 S234515AbhE0HF0 (ORCPT + 99 others); Thu, 27 May 2021 03:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233092AbhE0HFY (ORCPT ); Thu, 27 May 2021 03:05:24 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC9DC061574; Thu, 27 May 2021 00:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=algR1xGAqGkW+cyqC0FjZ1B3MB1RsaFxY2Mhr0ENyvc=; b=jgP2B028zN2MAoXN5jm1jfgJQk 8cg25hlQRdEoas8x4ienzjIQ0MnW4BV7YS4nhEqpZCLlN9cA75uWdzgNz7XMIWX+g7iSRgVJdJzxC HNMCRWJHZ6Cy5PRs/h26Q7b3/LhP1GRyAXNisWs4CtQV+JBbDb2J9lKjzvgG8Ka7pjEvXmJ+9YnZy zGjbU+vjguN1W+Ghc2Gf2Zo9PU2L4Cqx/m1VkAvyFB2Gpz9UT3L4bIXZQE5V/LoIwRd7Naz37T2C6 RLb3PxBpqJwcL/d05trpWkfKi8hXk5uTLjr0FXoPfvKUjc/Dw6omQ/oKufvGadBXv3fYw+TC2iin6 GR1ENOIA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmA3L-000wGK-Ba; Thu, 27 May 2021 07:03:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5144F300223; Thu, 27 May 2021 09:03:39 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0EEA22C6D2B90; Thu, 27 May 2021 09:03:39 +0200 (CEST) Date: Thu, 27 May 2021 09:03:38 +0200 From: Peter Zijlstra To: Dietmar Eggemann Cc: Beata Michalska , Valentin Schneider , linux-kernel@vger.kernel.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, corbet@lwn.net, rdunlap@infradead.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v5 2/3] sched/topology: Rework CPU capacity asymmetry detection Message-ID: References: <20210524101617.8965-1-beata.michalska@arm.com> <20210524101617.8965-3-beata.michalska@arm.com> <87fsyc6mfz.mognet@arm.com> <20210524225508.GA14880@e120325.cambridge.arm.com> <87a6oj6sxo.mognet@arm.com> <20210525102945.GA24210@e120325.cambridge.arm.com> <98ad8837-b9b8-ff50-5a91-8d5951ee757c@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98ad8837-b9b8-ff50-5a91-8d5951ee757c@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 11:52:25AM +0200, Dietmar Eggemann wrote: > For me asym_cpu_capacity_classify() is pretty hard to digest ;-) But I > wasn't able to break it. It also performs correctly on (non-existing SMT) > layer (with sd span eq. single CPU). This is the simplest form I could come up with this morning: static inline int asym_cpu_capacity_classify(struct sched_domain *sd, const struct cpumask *cpu_map) { struct asym_cap_data *entry; int i = 0, n = 0; list_for_each_entry(entry, &asym_cap_list, link) { if (cpumask_intersects(sched_domain_span(sd), entry->cpu_mask)) i++; else n++; } if (WARN_ON_ONCE(!i) || i == 1) /* no asymmetry */ return 0; if (n) /* partial asymmetry */ return SD_ASYM_CPUCAPACITY; /* full asymmetry */ return SD_ASYM_CPUCAPACITY | SD_ASYM_CPUCAPACITY_FULL; } The early termination and everything was cute; but this isn't performance critical code and clarity is paramount.