Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp983923rdh; Fri, 24 Nov 2023 02:44:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlPjxvADdrdZmdVYbhGoIQE9YemIBzLaw3tJIg3oAdOKGtHoGnR5B9OEGZCFXASYSsfZut X-Received: by 2002:a17:902:8343:b0:1cc:32ce:bd9 with SMTP id z3-20020a170902834300b001cc32ce0bd9mr1887204pln.69.1700822660066; Fri, 24 Nov 2023 02:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700822660; cv=none; d=google.com; s=arc-20160816; b=sHCrP27ftAEIwM/ONosQo8OLE0rwfeMeRMZHd1pisUE9L40LHUzUtLSvNsZ7eJIw8c XwYCYX1EgJfvyTStynJ2Tddom2m0wL0JPgkblQ9uDMc6e7J8XS3AmwarcL3mBKWx5w4F +lnF/QeUwGVgQWL/f/HSGhi8CYxQgB1hccF3kGtibEptuYxhrC1f2UQDbFLk4/kSaJ1V oSGg9l7RROQU2fA+gIT4HOjhoNhZ0qRcnZecfESo1t16OD3mm3pAhPzLXwfAJ0LmsUcO cVp0DCeYy1JUJuMB++MILoRatrZZrR6rfSc1FnfDid8ypVyrVIa7YLlq4WpMYFqjSphG vNVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=hXCCiITtMONKXafqT3vyMDrZ56Npve9aXTqwd4G4n4U=; fh=pEBF/Inw+GXiW9keaDUSswyEj07JckxRW/BNVxInCyE=; b=RvB9jjIHbM/gb+h/eBspocgqlsCyjNJao76H+zTAxC/PbMyBW/cKE2yWiWWd8K6ywZ +erJJFy+kXj36MsPxfZCCuLPZUunS4/za2ejPzdwxjFJ29TwC5nR4ZDvOucysXB6Aa+r BhzCNWVC1oH3SEn5xwVds/tNT34c0lOJhW6+bwNUcG7edVqXAoXww1fWqTxMCj9QXE6K e0VJFhnMdILSSsDT4L0xf5kRhQAm7ZzUtf3KxzJGBRtaHqVN+Izn7kHMvnOdJAL58U0E gJUDAPc3O1Urx5gnpQKJWpYp7PlnGGdKRn1J7vXa1OiJDmO7VgRZ2KmPRZQQPrqgHs8n a89w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id b21-20020a170902d31500b001c610ae885bsi3107941plc.59.2023.11.24.02.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 02:44:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 876CC804E337; Fri, 24 Nov 2023 02:44:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345658AbjKXKoA (ORCPT + 99 others); Fri, 24 Nov 2023 05:44:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345606AbjKXKn6 (ORCPT ); Fri, 24 Nov 2023 05:43:58 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D1BF10F8; Fri, 24 Nov 2023 02:44:02 -0800 (PST) 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 16E251063; Fri, 24 Nov 2023 02:44:49 -0800 (PST) Received: from [10.57.4.20] (unknown [10.57.4.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 991283F7A6; Fri, 24 Nov 2023 02:44:00 -0800 (PST) Message-ID: <4a005396-46fd-443c-be15-6fe0e2a1dea5@arm.com> Date: Fri, 24 Nov 2023 10:43:59 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/pelt: avoid underestimate of task utilization Content-Language: en-US To: Vincent Guittot Cc: lukasz.luba@arm.com, mingo@redhat.com, mgorman@suse.de, rostedt@goodmis.org, bristot@redhat.com, peterz@infradead.org, rafael@kernel.org, vschneid@redhat.com, dietmar.eggemann@arm.com, juri.lelli@redhat.com, bsegall@google.com, qyousef@layalina.io, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org References: <20231122140119.472110-1-vincent.guittot@linaro.org> From: Hongyan Xia In-Reply-To: <20231122140119.472110-1-vincent.guittot@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 24 Nov 2023 02:44:17 -0800 (PST) On 22/11/2023 14:01, Vincent Guittot wrote: > [...] > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 07f555857698..eeb505d28905 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4774,6 +4774,11 @@ static inline unsigned long task_util(struct task_struct *p) > return READ_ONCE(p->se.avg.util_avg); > } > > +static inline unsigned long task_runnable(struct task_struct *p) > +{ > + return READ_ONCE(p->se.avg.runnable_avg); > +} > + > static inline unsigned long _task_util_est(struct task_struct *p) > { > struct util_est ue = READ_ONCE(p->se.avg.util_est); > @@ -4892,6 +4897,14 @@ static inline void util_est_update(struct cfs_rq *cfs_rq, > if (task_util(p) > arch_scale_cpu_capacity(cpu_of(rq_of(cfs_rq)))) > return; > > + /* > + * To avoid underestimate of task utilization, skip updates of ewma if > + * we cannot grant that thread got all CPU time it wanted. > + */ > + if ((ue.enqueued + UTIL_EST_MARGIN) < task_runnable(p)) > + goto done; > + > + Actually, does this also skip util_est increases as well, assuming no FASTUP? When a task is ramping up, another task could join and then blocks this task from ramping up its util_est. Or do we think this is intended behavior for !FASTUP? > /* > * Update Task's estimated utilization > *