Received: by 10.223.176.5 with SMTP id f5csp1022474wra; Tue, 6 Feb 2018 11:11:13 -0800 (PST) X-Google-Smtp-Source: AH8x225sbSQTHQR1rt92QKubNgIz/9cACNpkwm+ST1CDPRQXhirBuypT/lZva7e8nWAiONkjIyKv X-Received: by 10.101.71.129 with SMTP id e1mr2748252pgs.430.1517944273666; Tue, 06 Feb 2018 11:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517944273; cv=none; d=google.com; s=arc-20160816; b=SX5RndZnWHKHkuQqweWX7Dn62mk7Dpg/P6CrOiciD1idBBshNRxo0gbG/dULz4So2c 5fkHJ1EuSJqCiR2iC2OUuAOws5k+8vD7uELQRxwgSwKA7XAtO5SksBdMaEGIRlJZwH68 /978P1OJX6TOox38oc2WWSJw09I/jX33JBKiqVk649uvMkgTRM7seMp/aVgOsLIQ7OVW WOeuoOFpnVgPClPF5EQXg+TjmMpTldDW8SUTlFnxCx6WRUDdVGsUxhB43uLUDErd7zs1 BQhmxznee85uFZsUczEVt/EvXMmrfV5al3fNrR+zrSN4IiZt5fx/tXxuSQo5Bw2Xo6ck wlJQ== 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=ORKPv/HmTdLAmhvc2Vmlw5GQv1AkwL2tOLU1TjQ7pNY=; b=afRCqcmfwM7ru7O3Y8xEXvmi4+3XXY2No5uue6C4klU+rowQQnh7hDEfEal3VtOtyS t0KXwYgTux36IuzTXmRyCQ0Exb84V+4l0UXsU9Ae4ervzDyOWDHu4jyEohsWYmmKEZKz aWVWj8+DrEVT23GOSlUQ8yDr9Uk0HRrfn/we5KWQMX+cvVVqb3AF3EkWhAMxyEnyGoaL zTGMmTvR0YCpXF7y6LvEqP3PaC+BCb1vNMPMTEbKSkqI9OZNe05CFatPd/oSmAb+CckG xpvtEZZosIRi1pRt+yTvqGojzpD1BtL0QT5EfG/YLBxfOt1Rejj552YPkxBL2m5TTEyr EX9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=gaf9mm4l; 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 e82si2807600pfh.159.2018.02.06.11.10.59; Tue, 06 Feb 2018 11:11:13 -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=merlin.20170209 header.b=gaf9mm4l; 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 S1753279AbeBFTJV (ORCPT + 99 others); Tue, 6 Feb 2018 14:09:21 -0500 Received: from merlin.infradead.org ([205.233.59.134]:60546 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752688AbeBFTJP (ORCPT ); Tue, 6 Feb 2018 14:09:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=ORKPv/HmTdLAmhvc2Vmlw5GQv1AkwL2tOLU1TjQ7pNY=; b=gaf9mm4lOpihs4jJm+o7HXT7I sfaFcUscfAMfhaH8tGRO28K7sPhhT8jCuvqp4a6WfSDV0bXPIO2IhvQTnqS5UzNptwFB/cB/8X9ns hrk3ZXR63SyP5g7OPln5mq0kJMJTIutkaErCrznj1+kOUz0MRSTGasg1lZyJs/M7fYPfvPFEW7OFK 1u3zjKX3AQqFZvE9MuSfbdkK64w3z84f6cF+8WTL4SaJfdgEW1K7iGafuJt2VVG9fLpEgbkNbrSiv eez7bYQqz4P8beT0OjLX06suW67rES/cDM3vN9InTjwnbXjV8xMKlGa8uQarISlErua4TAGIUgqeb Jx0/9Hddg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ej8c3-0003jx-A5; Tue, 06 Feb 2018 19:09:03 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 852BA2029F9F9; Tue, 6 Feb 2018 20:09:00 +0100 (CET) Date: Tue, 6 Feb 2018 20:09:00 +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 v4 1/3] sched/fair: add util_est on top of PELT Message-ID: <20180206190900.GN2249@hirez.programming.kicks-ass.net> References: <20180206144131.31233-1-patrick.bellasi@arm.com> <20180206144131.31233-2-patrick.bellasi@arm.com> <20180206155056.GF2269@hirez.programming.kicks-ass.net> <20180206183315.GG5739@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180206183315.GG5739@e110439-lin> 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, Feb 06, 2018 at 06:33:15PM +0000, Patrick Bellasi wrote: > Good point, I was actually expecting this question and I should have > added it to the cover letter, sorry. > > The reasoning was: the task's estimated utilization is defined as the > max between PELT and the "estimation". Where "estimation" is > the max between EWMA and the last ENQUEUED utilization. > > Thus I was envisioning these two calls: > > _task_util_est := max(EWMA, ENQUEUED) > task_util_est := max(util_avg, _task_util_est) > > but since now we have clients only for the first API, I've not added > the second one. Still I would prefer to keep the "_" to make it clear > that's and util_est's internal signal, not the actual task's estimated > utilization. > > Does it make sense? > > Do you prefer I just remove the "_" and we will refactor it once we > should add a customer for the proper task's util_est? Hurm... I was thinking: task_util_est := max(util_avg, EWMA) But the above mixes ENQUEUED into it.. *confused*. Also, I think I'm confused by the 'enqueued' name... it makes sense for the cfs use-case, where we track the sum of all 'enqueued' tasks, but it doesn't make sense for the task use-case where it tracks task_util() at dequeue time. > > > +/* > > > + * Check if the specified (signed) value is within a specified margin, > > > + * based on the observation that: > > > + * abs(x) < y := (unsigned)(x + y - 1) < (2 * y - 1) > > > + */ > > > +static inline bool within_margin(long value, unsigned int margin) > > > > This mixing of long and int is dodgy, do we want to consistently use int > > here? > > Right, perhaps better "unsigned int" for both params, isn't? Can't, must be signed, since @value is supposed to be able to be negative remember? ;-) > > > + WRITE_ONCE(cfs_rq->avg.util_est.enqueued, util_est); > > > + WRITE_ONCE(p->se.avg.util_est.enqueued, util_last); > > > > Two stores to that word... can we fix that nicely? > > Good point, the single word comes from the goal to fit into the same > cache line of sched_avg. Its the above two stores I confuzzled to be the same. So n/m all that. > > > +SCHED_FEAT(UTIL_EST, false) > > > > Since you couldn't measure it, do we wants it true? > > I'm just a single tester so far, I would be more confident once > someone volunteer to turn this on to give a better coverage. Lets just enable it by default, that way its far more likely someone will complain about it :-), disabling it again is a trivial matter when needed. Also, your patch 2/3 have insufficient READ_ONCE()s.