Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1926442pxb; Fri, 10 Sep 2021 18:21:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjCC+5WTnrJg/jpLl/2ll10NCFV32owwxzS1mFZDkyoQKPRJ6MQoiNwYRtzI6fnWhFegSI X-Received: by 2002:a92:bf01:: with SMTP id z1mr339197ilh.155.1631323265756; Fri, 10 Sep 2021 18:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631323265; cv=none; d=google.com; s=arc-20160816; b=W9jOEU0s/sZVlOwj7xPGWgQVF/qeLZODbX0ujmzxqh2IXNhbgqcFqC8Vz9987F62xh QMTjXbkuZISVDZt9Pe5c56qqNkkkB2wO11k0DJGDOiLVJLL+rKmYh18dhOvMv8L2sXMe StDLNkPfrM39b7EqITxE9SBLn0wDaKeKPcaSwQpmYiEiwfbXDaASsbkObhxUzQxBIxuW zupSNZjcDNFqDJ7m5mDINop58v3sUymvRk17R1kY6+8okiI1AcF+hLlcwaq+kKo5L2N8 VifIPCZVSHHHNpDdElTLDcE3uES8LKD8Vo5674qG6E6nSMu99nLW1mYNDHmw8AphGC6P Iw3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=RR0evL26NJ+50mPdn3gs8V3mtQvcPVDUlShtLtGEvy8=; b=Bh+tYBUKRRr8NH/QCyKqzmTPElvw3TUlu10NoXuWSkCX+mns29HbDDZVrl3crzqAOP GpWDHK0z7vVbWDrCAvOGn3ymS7jQtLw/yPQon0XiEQAzLsmLcJxf+NNH8yxHYEx2KeMQ aCIgzA86hFw2lKCke5gHA1qvvL3701A60UaVYAXPhr5X2QqJ/THCrxe+rSdHUdfsTc+K m9i5/i3EvY06ehOR/onqM6IF76aMOrkdpPjgErBoBe1use2d2LKvG51bH+jEtFf4zF7Z 7B+ghdqhGSsS3qfOkyw/e2Er80kyt50shRCo/1pUgzxk5PiEOfvqxyAgPiCSbr+CcflW LrCA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si206948ilp.123.2021.09.10.18.20.53; Fri, 10 Sep 2021 18:21:05 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235129AbhIKBVA (ORCPT + 99 others); Fri, 10 Sep 2021 21:21:00 -0400 Received: from mga18.intel.com ([134.134.136.126]:21357 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbhIKBUU (ORCPT ); Fri, 10 Sep 2021 21:20:20 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10103"; a="208325819" X-IronPort-AV: E=Sophos;i="5.85,284,1624345200"; d="scan'208";a="208325819" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2021 18:19:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,284,1624345200"; d="scan'208";a="695261642" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga006.fm.intel.com with ESMTP; 10 Sep 2021 18:19:08 -0700 From: Ricardo Neri To: "Peter Zijlstra (Intel)" , Ingo Molnar , Juri Lelli , Vincent Guittot Cc: Srikar Dronamraju , Nicholas Piggin , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Len Brown , Srinivas Pandruvada , Tim Chen , Aubrey Li , "Ravi V. Shankar" , Ricardo Neri , Quentin Perret , "Joel Fernandes (Google)" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Neri , Aubrey Li , Daniel Bristot de Oliveira , "Rafael J . Wysocki" Subject: [PATCH v5 5/6] sched/fair: Carve out logic to mark a group for asymmetric packing Date: Fri, 10 Sep 2021 18:18:18 -0700 Message-Id: <20210911011819.12184-6-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210911011819.12184-1-ricardo.neri-calderon@linux.intel.com> References: <20210911011819.12184-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create a separate function, sched_asym(). A subsequent changeset will introduce logic to deal with SMT in conjunction with asmymmetric packing. Such logic will need the statistics of the scheduling group provided as argument. Update them before calling sched_asym(). Cc: Aubrey Li Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Mel Gorman Cc: Quentin Perret Cc: Rafael J. Wysocki Cc: Srinivas Pandruvada Cc: Steven Rostedt Cc: Tim Chen Reviewed-by: Joel Fernandes (Google) Reviewed-by: Len Brown Co-developed-by: Peter Zijlstra (Intel) Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ricardo Neri --- Changes since v4: * None Changes since v3: * Remove a redundant check for the local group in sched_asym(). (Dietmar) * Reworded commit message for clarity. (Len) Changes since v2: * Introduced this patch. Changes since v1: * N/A --- kernel/sched/fair.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c5851260b4d8..26db017c14a3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8597,6 +8597,13 @@ group_type group_classify(unsigned int imbalance_pct, return group_has_spare; } +static inline bool +sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sg_lb_stats *sgs, + struct sched_group *group) +{ + return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu); +} + /** * update_sg_lb_stats - Update sched_group's statistics for load balancing. * @env: The load balancing environment. @@ -8657,18 +8664,17 @@ static inline void update_sg_lb_stats(struct lb_env *env, } } + sgs->group_capacity = group->sgc->capacity; + + sgs->group_weight = group->group_weight; + /* Check if dst CPU is idle and preferred to this group */ if (!local_group && env->sd->flags & SD_ASYM_PACKING && - env->idle != CPU_NOT_IDLE && - sgs->sum_h_nr_running && - sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) { + env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running && + sched_asym(env, sds, sgs, group)) { sgs->group_asym_packing = 1; } - sgs->group_capacity = group->sgc->capacity; - - sgs->group_weight = group->group_weight; - sgs->group_type = group_classify(env->sd->imbalance_pct, group, sgs); /* Computing avg_load makes sense only when group is overloaded */ -- 2.17.1