Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1037754rdh; Fri, 24 Nov 2023 04:05:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYHQ0DNNu/ETI7n/OQdbxkC5IHt3/6Msk46vd5oq3i07QEi70mQ9fBpDk5IW0rOaJ5P6zS X-Received: by 2002:a05:6870:b512:b0:1e9:8a35:8635 with SMTP id v18-20020a056870b51200b001e98a358635mr2849278oap.21.1700827519651; Fri, 24 Nov 2023 04:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700827519; cv=none; d=google.com; s=arc-20160816; b=vvObLrG4VrjzQX8ztB7HxUsRsF9nB+614BZAM2BmnWcFdtSD+A7Nu8pjOUFh7YemUW UVzvvy1vVcKmdVXs8SjTOtzqRibo83ya86OWbn75ADliVJ1o+OqMa3VD8e4vn/flzPz0 yij0LAGNLc3nuyG7+nJuWLnG4QfajVMEDTC747CJYRH76r9aIwZbeZC09SvEJ0TQxveM g+C3yy5UTwoaBoDarzAg3ykmAGspd4rhwyGUFTyogmh2Ias1oV6HRgzWTOwCaD9l/mIw U/Ux0HDJmoWw8vvUsQaWuzr1NnQecKK5inTkFqDAaYhYOXz5EHooUJ2a4ugByTB+BH7U 48uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wjNxGhDjeKHr8F+xhjRBHs3YO4GliXKBdRwWaSk3GKU=; fh=XIay3BKdST4Q4h8WeJL6pdKCiPqdAFWDkt2e+43NGkM=; b=IA/rIylzHy9GRsq6rdaM+tgnKf/ICkMH76FEReduyGAY7KZH3UbqaDLOpSGe2K58aK kMq8w2Nnckc9eYIx7cKdppVHdi2yffMCpMRxskQIhoBrUloNjZxzG1GSkMm+b2+hr2nx ekMnODHTUhUY/Sd7yN8/F/K1vAOMgiWnH+KyPE3OV/19g/tsLkxCz8BugRt6PM9/HxYP oOhlfo6/QAjnMfb25jztCx9VVHi9QG9onUiiiSjCN7XGZp5ca7YrBVqgq48bjW/2H/cF GRsPfaSPwzliIfqS/0mftQkDBiCQ8nqKazQdJBDjYMN2oSFVYccDY6KKsanUpoWbcHOn oHqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MfE8dzLZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id la6-20020a056871410600b001fa08d989e2si159459oab.200.2023.11.24.04.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 04:05:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MfE8dzLZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B6B3E8087393; Fri, 24 Nov 2023 04:05:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbjKXME7 (ORCPT + 99 others); Fri, 24 Nov 2023 07:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjKXME6 (ORCPT ); Fri, 24 Nov 2023 07:04:58 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFD0D41 for ; Fri, 24 Nov 2023 04:05:04 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1378426a12.1 for ; Fri, 24 Nov 2023 04:05:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700827504; x=1701432304; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wjNxGhDjeKHr8F+xhjRBHs3YO4GliXKBdRwWaSk3GKU=; b=MfE8dzLZQcG1CRnGxbR8zziMX2mT5XCZGDQgRQB3U/IylnJ+su4WeHQn9g/IYFjMoi BC6lb2rgAdCN09fU8Z9e6o34e0Pp0z7maYJIv4A0e1GN8tTzgKyThWSaSXieATG6BWo0 W4b9B3hHjqgGvb0UcidkQBvSSZsfVc7FAM98GRVqxW98UyZxh/a9M+pbGbNgGOHvCVTe jCPIG5UZUPpggMXlSTs+Jdy7lYeh0vCfqMYPnHT/7d+HM9m5qSsp1JxSKxlX44lmy8gp rU7Y7MXR0KO2BluYpCJXHUZubcVPkq5/B5i0G29V8XjW074Ix2aEI4c3Wkb55q76YPeX nj/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700827504; x=1701432304; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wjNxGhDjeKHr8F+xhjRBHs3YO4GliXKBdRwWaSk3GKU=; b=jXx587WWzV1NcUWvlfyqv7z15kJyp+eWctuFW6MdCJVkJK4/vBtRLoXhHhfXdLafRu n3ztCSMeJNYo/a4n+sZiYyLnA+noC2oj4MfN2UQKAQOXrkSkHIPDSU3RLrmrlkpHBF3P f37LxpzyDZu4Taxgq3FPa+1ZNaLV3nLLjJhaB9/a+tpXPr1UlMu/88vazobm5cAJ9pHt q9eMex2XxXDBD3CP7ytJjmJMoveS2+cpgOi4Tf5tarpqzG76i5DrCexQmi57+VhE4FEC RGxjH2rDfi7JUrCN1EC8hN8jpVMy7oIeAA+RJBPT/efxNmhaBCMDyLnsRon3apQDpIaP kW4Q== X-Gm-Message-State: AOJu0YwUbyF1nz00N04u0/rUklkurCl24Pm2dTrt9v79kGhKSWtntijh a86fGnPh1/SrKHduTj1QzQIcUiC1cs67gOwFHCvqDA== X-Received: by 2002:a17:90b:4f4d:b0:285:24bb:457c with SMTP id pj13-20020a17090b4f4d00b0028524bb457cmr2934120pjb.26.1700827504096; Fri, 24 Nov 2023 04:05:04 -0800 (PST) MIME-Version: 1.0 References: <20231122140119.472110-1-vincent.guittot@linaro.org> <4a005396-46fd-443c-be15-6fe0e2a1dea5@arm.com> In-Reply-To: <4a005396-46fd-443c-be15-6fe0e2a1dea5@arm.com> From: Vincent Guittot Date: Fri, 24 Nov 2023 13:04:51 +0100 Message-ID: Subject: Re: [PATCH] sched/pelt: avoid underestimate of task utilization To: Hongyan Xia 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 24 Nov 2023 04:05:16 -0800 (PST) On Fri, 24 Nov 2023 at 11:44, Hongyan Xia wrote: > > 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? sched_feat(UTIL_EST_FASTUP) has been there to disable faster ramp up in case of regression but I'm not aware of anybody having to disable it during the last 3 year so we should just delete the sched_feat() and make faster ramp up permanent. > > > /* > > * Update Task's estimated utilization > > *