Received: by 10.223.185.116 with SMTP id b49csp4835229wrg; Wed, 7 Mar 2018 01:41:06 -0800 (PST) X-Google-Smtp-Source: AG47ELvEN7aGjV8OmA60ClfF2SfMAtenPelKmvMIFNBEqo6vJ0+IElsPQU+gNLEwJFtGpXnp3SQI X-Received: by 10.99.114.81 with SMTP id c17mr3542373pgn.314.1520415666449; Wed, 07 Mar 2018 01:41:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520415666; cv=none; d=google.com; s=arc-20160816; b=vnJVMJzPxivkXtuMH6q6HdtezeJcUdhw5kkQf7bRDE1XDil1/c6b0jt323FX5KRyUb 2jz+Be4m+Kh3KNvpZK7ptIiS+7FtqO7eoGftwGU3HUZLbiQevUecE3U7EltbAuOqUZ6q IN96M7pe3Z/pHNX28m9B+GrjMMCHcjw9I7r0lJOAM6z/cn1P/t0WDbqL7k/LI+zyjoiP l5D7kZRpjalW8DWh4zFwq9uAPH4jdEmo/ZyP+/q/XnsD9A5lDK4NqKOyyt7jfTNysH2u fTbYHdk3WjJb8+Ymiw9PtuW9GCkjoqSxRAxcXIGLPOUY+9YjAO2xCulx0Lif2hZSkETU nNNw== 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:dkim-signature:arc-authentication-results; bh=t8qpMoUZH07uo7iCapjCBvHiUiuw2QbkCHgfrevOZJk=; b=mGq3GSZNbnubto4Pfhp8Sf+zy7jbKqa+o9SuUKBKhD8/X6Y+bv/wtj0c+DRFV5za0+ MopYNYYwULFKoq9xCkt45m62czfJpQQixFRW9ZYeHn8dFgCZfPXI8Xiudy8bdlne01IE C//blv/30emtPv5ldjYGBOUbRIENQO21JKgALL/y34Z+YiMuAEaTvjEx6pvpcR71zgW6 2bdEUdfQKsUUIUktzHtre14DHdXb5oa95KDeSQauC/A8By9o+mXI92m+I7OG1ItZLlrn q/Z3/9MiSXTpABeIioz9MjHq3mOIntFrrD1DFMQpjgzBfdMWeoNLbF7zfYRuFPjs5WPq Cupw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YICnDYS5; 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 b3-v6si12596373plc.317.2018.03.07.01.40.51; Wed, 07 Mar 2018 01:41:06 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YICnDYS5; 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 S1754108AbeCGJjq (ORCPT + 99 others); Wed, 7 Mar 2018 04:39:46 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:54004 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbeCGJjp (ORCPT ); Wed, 7 Mar 2018 04:39:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=t8qpMoUZH07uo7iCapjCBvHiUiuw2QbkCHgfrevOZJk=; b=YICnDYS59pSuJ2yaI03iCrZDC fME0V00AJaa7SjnA4NDsjeHtme8jKvAj8Pb3EVpiopb8YnBlrhD8XI6V9BXNEpo1jFaLAq9YUfpql /EUy7W7baO80RDkOni1BeDuYBan28W7u95O3tEa11Cp4ulsXIYf78FnGfPFYuVdG85OzyPgmBKYcI 0fY6blD8gqa6DPSHspe0xwVie7U2ggVdadgneH7mY9UQsQAgEZMi9d1DJtZ+ENERe4+i/sMT+IOQM 8fhCEgy0Wf9ZUH6Ml672FXFTfFXb09zhFGNHAHU1AEHNzo9SHlO1FolpJYnyn+0382RmeC2qg6rrg YVEX/0ezQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1etVXv-0003vh-3z; Wed, 07 Mar 2018 09:39:39 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 725982029FA14; Wed, 7 Mar 2018 10:39:37 +0100 (CET) Date: Wed, 7 Mar 2018 10:39:37 +0100 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v5 1/4] sched/fair: add util_est on top of PELT Message-ID: <20180307093937.GZ25235@hirez.programming.kicks-ass.net> References: <20180222170153.673-1-patrick.bellasi@arm.com> <20180222170153.673-2-patrick.bellasi@arm.com> <20180306185851.GG25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180306185851.GG25201@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 06, 2018 at 07:58:51PM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 05:01:50PM +0000, Patrick Bellasi wrote: > > +static inline void util_est_enqueue(struct cfs_rq *cfs_rq, > > + struct task_struct *p) > > +{ > > + unsigned int enqueued; > > + > > + if (!sched_feat(UTIL_EST)) > > + return; > > + > > + /* Update root cfs_rq's estimated utilization */ > > + enqueued = READ_ONCE(cfs_rq->avg.util_est.enqueued); > > + enqueued += _task_util_est(p); > > + WRITE_ONCE(cfs_rq->avg.util_est.enqueued, enqueued); > > +} > It appears to me this isn't a stable situation and completely relies on > the !nr_running case to recalibrate. If we ensure that doesn't happen > for a significant while the sum can run-away, right? > > Should we put a max in enqueue to avoid this? Thinking about this a bit more; would it make sense to adjust the running sum/avg on migration? Something along the lines of: util_avg = se->load_avg / (cfs_rq->load_avg + se->load_avg); (which disregards cgroups), because that should more or less be the time it ends up running, given the WFQ rule. That way the disparity between tasks migrating into the CPU at u=1 and them going to sleep at u<1 is much smaller and the above sum doesn't run away nearly as wild (it still needs some upper bound though).