Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp972410imm; Tue, 5 Jun 2018 07:18:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLlMgDIutBypJUUYMQLYETa/MRa13BDLjJJkzFRGzpKGLv0lROd6XvXJ0Elgype49goUWra X-Received: by 2002:a63:27c6:: with SMTP id n189-v6mr21374621pgn.164.1528208336714; Tue, 05 Jun 2018 07:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528208336; cv=none; d=google.com; s=arc-20160816; b=c5L1LUWEcmpZ+TbUjrLL6naRNBCnz/ED7dXUiPpAs79P7eBdu1DZBmDwx5sfqjYaJc xY9YF/eHJJSmgXCkjKeXbUEyzQjjUXc04h7fiLOeM12JT+WvhCwhTy2Yeewddg6ZG4O0 hnfzH+PheGyQMb65LF676ipZvgawyioG4X4tzzawk9Wr3kuZNHv9pPCSBOOr9FZ87F5m 6TD5o+E+TaxjiJ2wINsC9Wmz+HUXzr698p8wW4fk6X9lnGS9fbTNJJrsSEcLP3ylIE6X 6ABqgiOFUaR8wLYZKhZvsYQn6D3UmYCLEhvbrTd7nSd2BMYr23MHS0wlXGHqvuAaXP7l FTvA== 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=FVGIDfdYE1TNSuAA4BDR6GP1DxV7IHpHpzFG5n189HY=; b=MQaAHpyBl67chUzYqhyVloaprxuDz+4WtqLXhUFCLuDnvw+C885EdQxNRALD0YRnqh TRAZSZYV6gKhCwX46SzKgOzyIo6Uy2cTwNg+WLurKEIjBZtZl7pnfDCQrQPQJnZIZfU5 Y6mlGhUVlbvUdOC6kztyL+kb9TbkEXRytwBhXKGr/lz0T/KuZle9VM5M9wBwD76RP2XN 9fbug1luB/8mWejjC39hnfkbbdEwSZrAG3ass43jSqCrI7hdM7n2MyQbTPH8UnnXhrZG scZRpdkmhJQzC0thJRt9A0eeMUUuwsEtMkvEPevcjuS0NEJCLTI02UjJK4cfWBr2Ut4h zT4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=d0YK3s12; 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 k8-v6si11102050pgc.182.2018.06.05.07.18.42; Tue, 05 Jun 2018 07:18:56 -0700 (PDT) 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=d0YK3s12; 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 S1752069AbeFEOSR (ORCPT + 99 others); Tue, 5 Jun 2018 10:18:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49850 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbeFEOSQ (ORCPT ); Tue, 5 Jun 2018 10:18:16 -0400 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=FVGIDfdYE1TNSuAA4BDR6GP1DxV7IHpHpzFG5n189HY=; b=d0YK3s12bWINm/bm2KJE4sDHZ TF1P/MtZAYxhartj/SJ1vwVrLyjgnWaGEdNL9kT0C3Zw9E8tTTnZprfjmjTqZ/hPJGnazYllJywci 8OGmpDKDrimYvgN+ZWuMajfdEPxaCfajMOicwg2MysUUUB7HpTM0aWIXwUhJ1MvuFIUNATDyqxWBa ZE6P1b58ZgW/C68N3KYXhGkSzxbP01cTXBkl/s/ssEzPWwQbsge3fRwVBVMrxJUFSWApNfGlgd9rZ ZTwDOeXqemNZftPJBj2EX2F6ildsrGCdhTiEV9j2OZ7PSHyIFX4rbAWm80kFn4jytl+u+Bt0XX+za nKJhBhquA==; 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.90_1 #2 (Red Hat Linux)) id 1fQCmp-00073F-DE; Tue, 05 Jun 2018 14:18:11 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D3DF5201EA7A0; Tue, 5 Jun 2018 16:18:09 +0200 (CEST) Date: Tue, 5 Jun 2018 16:18:09 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Juri Lelli , Dietmar Eggemann , Morten Rasmussen , viresh kumar , Valentin Schneider , Quentin Perret Subject: Re: [PATCH v5 00/10] track CPU utilization Message-ID: <20180605141809.GV12180@hirez.programming.kicks-ass.net> References: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> <20180604165047.GU12180@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 08:08:58PM +0200, Vincent Guittot wrote: > On 4 June 2018 at 18:50, Peter Zijlstra wrote: > > So this patch-set tracks the !cfs occupation using the same function, > > which is all good. But what, if instead of using that to compensate the > > OPP selection, we employ that to renormalize the util signal? > > > > If we normalize util against the dynamic (rt_avg affected) cpu_capacity, > > then I think your initial problem goes away. Because while the RT task > > will push the util to .5, it will at the same time push the CPU capacity > > to .5, and renormalized that gives 1. > > > > NOTE: the renorm would then become something like: > > scale_cpu = arch_scale_cpu_capacity() / rt_frac(); Should probably be: scale_cpu = atch_scale_cpu_capacity() / (1 - rt_frac()) > > > > > > On IRC I mentioned stopping the CFS clock when preempted, and while that > > would result in fixed numbers, Vincent was right in pointing out the > > numbers will be difficult to interpret, since the meaning will be purely > > CPU local and I'm not sure you can actually fix it again with > > normalization. > > > > Imagine, running a .3 RT task, that would push the (always running) CFS > > down to .7, but because we discard all !cfs time, it actually has 1. If > > we try and normalize that we'll end up with ~1.43, which is of course > > completely broken. > > > > > > _However_, all that happens for util, also happens for load. So the above > > scenario will also make the CPU appear less loaded than it actually is. > > The load will continue to increase because we track runnable state and > not running for the load Duh yes. So renormalizing it once, like proposed for util would actually do the right thing there too. Would not that allow us to get rid of much of the capacity magic in the load balance code? /me thinks more.. Bah, no.. because you don't want this dynamic renormalization part of the sums. So you want to keep it after the fact. :/ > As you mentioned, scale_rt_capacity give the remaining capacity for > cfs and it will behave like cfs util_avg now that it uses PELT. So as > long as cfs util_avg < scale_rt_capacity(we probably need a margin) > we keep using dl bandwidth + cfs util_avg + rt util_avg for selecting > OPP because we have remaining spare capacity but if cfs util_avg == > scale_rt_capacity, we make sure to use max OPP. Good point, when cfs-util < cfs-cap then there is idle time and the util number is 'right', when cfs-util == cfs-cap we're overcommitted and should go max. Since the util and cap values are aligned that should track nicely.