Received: by 10.223.176.5 with SMTP id f5csp1514757wra; Wed, 31 Jan 2018 07:33:21 -0800 (PST) X-Google-Smtp-Source: AH8x225SaPwEXYCf6BnNC5haBf5Gzk0yQ1tTV3fgIzxuNGYF3YnPMBkDdl9qwd6syCgzVUOQ9ceg X-Received: by 10.98.217.135 with SMTP id b7mr33464389pfl.239.1517412800971; Wed, 31 Jan 2018 07:33:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517412800; cv=none; d=google.com; s=arc-20160816; b=KyuipBJVpo28p2I8lCnDuNf8IXwmw/OArOr6LdQ1LuPYciKJy32dbJ+k1wLQCxlEr/ MChI3Swg5W1KTS7JSVbt3GVY/v+WA3TEZpY7m57ZyoRZo6ha+MsqFmylfqvlMb0ywpv3 0VQ09V1CmmGdJPHkU1SgJ6yGGayfYTD6j5xMm7Rir7IsWWGVIJuLs22JyvzDklLtdRx6 FpRvZYLiBqES1GmgrcudnSpzBBrz+Mz9UPa7zfJ+5P3PvGR7AaL6m5XZW5Cqyoj6Jqcs Wvii/90vri6dIf+WuZgCvUmb4oxCaMRB4FrWYFTTEPNQh6SgAiWonXIYq9DU86j/lvxQ 3QGg== 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:arc-authentication-results; bh=zuZmb+alsLegvkcMBV/qJ1RwfzkKzSaNvkK0E1bPRoM=; b=tru5BtZi5vGUWFurt4LBs0ukT7U3paPqL/92SvzqhSoqvHCOLrWWxIV+2eD6jf7SZB b+PWSdiBwgSXU7YhDLYwzXGCrxxEGPStbP/vc90hWRygT7+wiqxzmxte7/e9aGSDOpBt DcxozZzXw/mDCHwp7sO9Ustzd12ngziXHdYNgbfhZeVZl2vIOOMBp5MllGWXwKN3+YZu 8yOR+r0XHiVBRSq4JuYSog3LgT9p1uRGAASMeSiHIYXjomuJOu+289xxfiKDV+DZCyfH XvnKtth75bhcQzqDprU8a1mmyTDfwaqjuU49osPWhD4amVkMtH0bgVnIIMSfm7zlXvzB nGuQ== 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 i13-v6si2651143plr.187.2018.01.31.07.33.05; Wed, 31 Jan 2018 07:33:20 -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 S932093AbeAaPcb (ORCPT + 99 others); Wed, 31 Jan 2018 10:32:31 -0500 Received: from foss.arm.com ([217.140.101.70]:39292 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753556AbeAaPc3 (ORCPT ); Wed, 31 Jan 2018 10:32:29 -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 980471529; Wed, 31 Jan 2018 07:32:28 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1AB383F41F; Wed, 31 Jan 2018 07:32:25 -0800 (PST) Date: Wed, 31 Jan 2018 15:32:23 +0000 From: Patrick Bellasi To: Pavan Kondeti Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v3 2/3] sched/fair: use util_est in LB and WU paths Message-ID: <20180131153223.GD5739@e110439-lin> References: <20180123180847.4477-1-patrick.bellasi@arm.com> <20180123180847.4477-3-patrick.bellasi@arm.com> <20180124113342.GD30677@codeaurora.org> <20180124193138.GB5739@e110439-lin> <20180125143358.GE30677@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180125143358.GE30677@codeaurora.org> 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 25-Jan 20:03, Pavan Kondeti wrote: > On Wed, Jan 24, 2018 at 07:31:38PM +0000, Patrick Bellasi wrote: > > > > > > + /* > > > > + * These are the main cases covered: > > > > + * - if *p is the only task sleeping on this CPU, then: > > > > + * cpu_util (== task_util) > util_est (== 0) > > > > + * and thus we return: > > > > + * cpu_util_wake = (cpu_util - task_util) = 0 > > > > + * > > > > + * - if other tasks are SLEEPING on the same CPU, which is just waking > > > > + * up, then: > > > > + * cpu_util >= task_util > > > > + * cpu_util > util_est (== 0) > > > > + * and thus we discount *p's blocked utilization to return: > > > > + * cpu_util_wake = (cpu_util - task_util) >= 0 > > > > + * > > > > + * - if other tasks are RUNNABLE on that CPU and > > > > + * util_est > cpu_util > > > > + * then we use util_est since it returns a more restrictive > > > > + * estimation of the spare capacity on that CPU, by just considering > > > > + * the expected utilization of tasks already runnable on that CPU. > > > > + */ > > > > + util_est = cpu_rq(cpu)->cfs.util_est_runnable; > > > > + util = max(util, util_est); > > > > + > > > > + return util; > > > > I should instead clamp util before returning it! ;-) > > > > > May be a separate patch to remove the clamping part? > > > > No, I think we should keep cpu_util_wake clamped to not affect the existing > > call sites. I just need to remove it where not needed (done) and add it where > > needed (will do on the next iteration). > > cpu_util_wake() is called only from capacity_spare_wake(). There are no other > callsites. True... > The capacity_spare_wake() is clamping the return value of > cpu_util_wake() to CPU capacity. ... actually it's clamping negative numbers with: max_t(long, capacity_of(cpu) - cpu_util_wake(cpu, p), 0); thus, by having cpu_util_wake returning potentially a value which is bigger then capacity_of or capacity_orig_of we should not have issues from a capacity_spare_wake() usage standpoint. > The clamping is not needed, I think. However, we can still argue that the cpu_util_wake() should never return something bigger then the maximum possible capacity of a CPU. At least that's the feature so fare. Thus, even just for the sake of consistency, with previous returns paths (e.g. when we bail out returning cpu_util), I would say that it's worth to maintain this semantics. With a clamping, all these functions: - cpu_util - cpu_util_est - cpu_util_wake will always return a signal which is never bigger then the maximum possible CPU capacity. -- #include Patrick Bellasi