Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp547565rwj; Fri, 23 Dec 2022 05:10:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXua2pqIhJD0xuLm9ZKWisE5GQR75NcZS8lTyBq+ugx2Bhv3oZlFIBtEuV+9UJ/jH08V5sZF X-Received: by 2002:a17:90a:2b01:b0:21a:20f9:262f with SMTP id x1-20020a17090a2b0100b0021a20f9262fmr11474571pjc.7.1671801043322; Fri, 23 Dec 2022 05:10:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671801043; cv=none; d=google.com; s=arc-20160816; b=t0z1cZ1Ub85bQZXIEJmkXFFi2+xl52TeTar1/ZTkrs2ufhYH/MsMVf+v/yKCm6ofxY +mns2vyJD4Xtt1MBkidAEzXoLEQT62iiv2UKnqLg2tjSbl6UPPNe1ERqb0ZNGi4h6oid RRcoqadXwfUl7o2WUf/Np2LJK3thXI5tLSSvmPfLzA9EsE1J5PC3mByIuNbGu3M7mi32 FHxHUaMGJXSvOMyUyChQXBM28s9HyRMeQHylg/jwbmTyY1ujXNnVUdAP0Vd06Vaxs5aq lq2uxzdu/ewxBHYO6m3ZGt+J4J9YoUn1H7ZyPCBs9IEu75JpOH/rwsey1N9jLd5AAwDk 1Blg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2UTqodWNDJoWXf+WlyAmUCdfY4kwYD/2NWJvgyXKlAQ=; b=M9ZjtMp8gKeSdxilb3hGEuwbv0gLK85JLA+nOIBxNiTB7W0/CAdh3kb6nFWjajfCzf hNgbg3FBVt8PGzO9N1Et3u/0mNbHcGraSNVBiJ8da4n9LIgVAMTsZ8G+zulKZBKusccR mspfkjjEzV4auxF/AHVH5iex7E7W5aPIKDHLiJgVuPtpr8ZN3jqu4BqGOjqstSP0FSry frwdaEvcKan3IGcH7J3IMNWN3QE4xlzxMegnZVdL+I8kSC1O6MRt1C4YAkKhM3G6C7Yc mnkndOMFZjndcaewoeLjWY9hoByRDD30SDSrgleF9CTJVB/257FhWef72xQe/le7Owa9 XKWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ekrp1AN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a72-20020a63904b000000b00477bfab5a83si3853732pge.2.2022.12.23.05.10.34; Fri, 23 Dec 2022 05:10:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ekrp1AN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236215AbiLWNDQ (ORCPT + 66 others); Fri, 23 Dec 2022 08:03:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235617AbiLWNDO (ORCPT ); Fri, 23 Dec 2022 08:03:14 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275AD11C2B for ; Fri, 23 Dec 2022 05:03:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671800593; x=1703336593; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=O6Wh20C5t6jZyBUrm+gsAKdKoNwqaHG/tB1n0ehrdaM=; b=Ekrp1AN6t6Z0M28ksq5TqwmJdNMDdVYrrB9CHmOEDVPGGcJnfH2kno3I pxRBODbL0RYqHVaNlAjN/WhtLl9hzWax/QZaoP/3gh5pNQV90m7Gi/zUh +UwDyE4MyTkgIbEr4P0eZqAYt3tm3wp+qlCLIu/0c0y/26fcgy1MGD4Cg 5Rkb7QlF60u4VP8IWdG3kLC7DG6fcrKZ/Sb0T6V7OBa0Vgfr1L3cI82nf v0B5DbCmBq8gvMpkhNZ3syy/XVwOsgy8C6Hh6NYoJb+Q5ScfUvSIGy2Re wSk3MEVE0y/gVW4P5EYvrnkyHUvqrEZ5N2dvEO9+bW/dDy+WiGGw78yau Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="308042652" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="308042652" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 05:03:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="682724008" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="682724008" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga008.jf.intel.com with ESMTP; 23 Dec 2022 05:03:11 -0800 Date: Fri, 23 Dec 2022 05:11:38 -0800 From: Ricardo Neri To: Dietmar Eggemann Cc: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot , Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org, "Tim C . Chen" Subject: Re: [PATCH v2 1/7] sched/fair: Generalize asym_packing logic for SMT local sched group Message-ID: <20221223131138.GA5856@ranerica-svr.sc.intel.com> References: <20221122203532.15013-1-ricardo.neri-calderon@linux.intel.com> <20221122203532.15013-2-ricardo.neri-calderon@linux.intel.com> <76e23104-a8c0-a5fc-b8c6-27de79df2372@arm.com> <20221212175345.GA27353@ranerica-svr.sc.intel.com> <4f9aecf7-062e-8e85-1d3e-c010a85a010a@arm.com> <20221222043249.GA407@ranerica-svr.sc.intel.com> <2bff7fe9-c003-8757-1dbc-2b0f977d4e27@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bff7fe9-c003-8757-1dbc-2b0f977d4e27@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 22, 2022 at 12:12:00PM +0100, Dietmar Eggemann wrote: > On 22/12/2022 05:32, Ricardo Neri wrote: > > On Wed, Dec 21, 2022 at 02:03:15PM +0100, Dietmar Eggemann wrote: > >> On 12/12/2022 18:53, Ricardo Neri wrote: > >>> On Tue, Dec 06, 2022 at 06:22:41PM +0100, Dietmar Eggemann wrote: > >>>> On 22/11/2022 21:35, Ricardo Neri wrote: > >> > >> [...] > >> > >>>> I'm not sure why you change asym_smt_can_pull_tasks() together with > >>>> removing SD_ASYM_PACKING from SMT level (patch 5/7)? > >>> > >>> In x86 we have SD_ASYM_PACKING at the MC, CLS* and, before my patches, SMT > >>> sched domains. > >>> > >>>> > >>>> update_sg_lb_stats() > >>>> > >>>> ... && env->sd->flags & SD_ASYM_PACKING && .. && sched_asym() > >>>> ^^^^^^^^^^^^ > >>>> sched_asym() > >>>> > >>>> if ((sds->local->flags & SD_SHARE_CPUCAPACITY) || > >>>> (group->flags & SD_SHARE_CPUCAPACITY)) > >>>> return asym_smt_can_pull_tasks() > >>>> ^^^^^^^^^^^^^^^^^^^^^^^^^ > >>>> > >>>> So x86 won't have a sched domain with SD_SHARE_CPUCAPACITY and > >>>> SD_ASYM_PACKING anymore. So sched_asym() would call sched_asym_prefer() > >>>> directly on MC. What do I miss here? > >>> > >>> asym_smt_can_pull_tasks() is used above the SMT level *and* when either the > >>> local or sg sched groups are composed of CPUs that are SMT siblings. > >> > >> OK. > >> > >>> In fact, asym_smt_can_pull_tasks() can only be called above the SMT level. > >>> This is because the flags of a sched_group in a sched_domain are equal to > >>> the flags of the child sched_domain. Since SMT is the lowest sched_domain, > >>> its groups' flags are 0. > >> > >> I see. I forgot about `[PATCH v5 0/6] sched/fair: Fix load balancing of > >> SMT siblings with ASYM_PACKING` from Sept 21 (specifically [PATCH v5 > >> 2/6] sched/topology: Introduce sched_group::flags). > >> > >>> sched_asym() calls sched_asym_prefer() directly if balancing at the > >>> SMT level and, at higher domains, if the child domain is not SMT. > >> > >> OK. > >> > >>> This meets the requirement of Power7, where SMT siblings have different > >>> priorities; and of x86, where physical cores have different priorities. > >>> > >>> Thanks and BR, > >>> Ricardo > >>> > >>> * The target of these patches is Intel hybrid processors, on which cluster > >>> scheduling is disabled - cabdc3a8475b ("sched,x86: Don't use cluster > >>> topology for x86 hybrid CPUs"). Also, I have not observed topologies in > >>> which CPUs of the same cluster have different priorities. > >> > >> OK. > >> > >> IMHO, the function header of asym_smt_can_pull_tasks() (3rd and 4th > >> paragraph ... `If both @dst_cpu and @sg have SMT siblings` and > > > > Agreed. I changed the behavior of the function. I will update the > > description. > > > >> `If @sg does not have SMT siblings` still reflect the old code layout. > > > > But this behavior did not change. The check covers both SMT and non-SMT > > cases: > > The condition to call sched_asym_prefer() seems to have changed slightly > though (including the explanation that busy_cpus_delta >= 2 handling > should be done by fbg().: > > sds->local_stat.sum_nr_running (A) > busy_cpus_delta = sg_busy_cpus - local_busy_cpus (B) > sg_busy_cpus = sgs->group_weight - sgs->idle_cpus (C) > > From ((smt && B == 1) || (!smt && !A)) to (C == 1 && !A) I agree that ((smt && B == 1) did change and I will update the comment. My point is that (!smt && !A) is equivalent to (C == 1 && !A) if @sg has only one CPU and is busy. The fourth paragraph still stands. > > > > > /* > > * non-SMT @sg can only have 1 busy CPU. We only care SMT @sg > > * has exactly one busy sibling > > */ > > if (sg_busy_cpus == 1 && > > /* local group is fully idle, SMT and non-SMT. */ > > !sds->local_stat.sum_nr_running) > > > > Perhaps I can collapse the two paragraphs into one. > > Sounds good to me. Will do. Thanks and BR, Ricardo