Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1049792imu; Wed, 28 Nov 2018 03:56:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/VbmyrBba2FeYinIsrtK/n8nmLjVFoCA+pbua6ys1DBbhtFEthidc6EkzwIiPPwpK6Rvygl X-Received: by 2002:a17:902:8e8a:: with SMTP id bg10mr36722259plb.192.1543406168184; Wed, 28 Nov 2018 03:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543406168; cv=none; d=google.com; s=arc-20160816; b=MNiLHgrZ3wPSrqV2L5oRLEVWjKT+RwhkSkg26RsB1TvdsAOEkfGeMHl9dw+goWFpF/ u+CAG4owPqZd4IXAzVkKtlib3WDxLjXIbGdleXcNyTSNHq3rynV6BB6A56+EKd22dc5W rmtqOnursgItce1Px97mr+HgYuDG4ea/owog1Vqzy5oYY6f33lKRktXc3s0De7fO+QVk pssV+rWfFsGTovb9h4gtNmA07fy826QIK/tI8Sb3CConE/XNUYagBi9hEPYn7ET5z+jf y+//9Dj+Maab4/DuXywxv56Q0UbAS3sJZx+qKB/D/BLNukjCoQLU9IUpHCtE8i7cinGm aH2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=DGqrOdiz1kloK/YyY2WZbgHfHtpjkK+7Q1dVQubEGck=; b=GoV8xc48Zrhdglx/ZwtC2JzhWNH+2LlbhlaEyDEo4OTtWwFgwge3FWoCQ78AEk5CU8 Um7UzgKXkxsivJuh6rnsYR0uY3CvqrytcT1uSQfwzISrE91hYb1+sPZL7A4MtvrZ5Gu1 mqKjOMaBKaIHALhN6S8n9e3KvEHi/erQBwrYbjLtGbKKrBlznF6WQKd3nkntBSJG3U5b DaYUAfHOMkdzAZuphwU0ndIkGTFC+0NJH+UySUSK0kGUT19YAOG7wrlkHgLJfII0jKJS WtFrch4eklC3QLWGmJ2LaukWnbgKyCXN9a5HI4lnsMO1pB9hLZulJDcR8qZltafwQVa3 KeXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si6972562plr.96.2018.11.28.03.55.53; Wed, 28 Nov 2018 03:56:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728006AbeK1WzF (ORCPT + 99 others); Wed, 28 Nov 2018 17:55:05 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36852 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727585AbeK1WzF (ORCPT ); Wed, 28 Nov 2018 17:55:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 795773650; Wed, 28 Nov 2018 03:53:41 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 413823F59C; Wed, 28 Nov 2018 03:53:39 -0800 (PST) Date: Wed, 28 Nov 2018 11:53:36 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: Vincent Guittot , Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Dietmar Eggemann , Morten Rasmussen , Paul Turner , Ben Segall , Thara Gopinath , pkondeti@codeaurora.org, Quentin Perret , Srinivas Pandruvada Subject: Re: [PATCH v7 2/2] sched/fair: update scale invariance of PELT Message-ID: <20181128115336.GB23094@e110439-lin> References: <1542711308-25256-1-git-send-email-vincent.guittot@linaro.org> <1542711308-25256-3-git-send-email-vincent.guittot@linaro.org> <20181128100241.GA2131@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181128100241.GA2131@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28-Nov 11:02, Peter Zijlstra wrote: > On Wed, Nov 28, 2018 at 10:54:13AM +0100, Vincent Guittot wrote: > > > Is there anything else that I should do for these patches ? > > IIRC, Morten mention they break util_est; Patrick was going to explain. I guess the problem is that, once we cross the current capacity, strictly speaking util_avg does not represent anymore a utilization. With the new signal this could happen and we end up storing estimated utilization samples which will overestimate the task requirements. We will have a spike in estimated utilization at next wakeup, since we use MAX(util_avg@dequeue_time, ewma). Potentially we also inflate the EWMA in case we collect multiple samples above the current capacity. So, a possible fix could be to avoid storing util_est samples if we end up with a utilization above the current capacity. Something like: ----8<--- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ac855b2f4774..93e0cf5d8a76 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3661,6 +3661,10 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep) if (!task_sleep) return; + /* Skip samples which do not represent an actual utilization */ + if (unlikely(task_util(p) > capacity_of(task_cpu(p)))) + return; + /* * If the PELT values haven't changed since enqueue time, * skip the util_est update. ---8<--- Could that work ? Maybe using a new utility function to wrap the new check. -- #include Patrick Bellasi