Received: by 10.213.65.68 with SMTP id h4csp3738356imn; Tue, 10 Apr 2018 04:02:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48T8mZO5XrutAimA3YwcdQf8u6wJgJh1qffqKWRostQOLCS05C8ljwLYpEeRcuAtoWN3fJW X-Received: by 2002:a17:902:7611:: with SMTP id k17-v6mr5256054pll.244.1523358167528; Tue, 10 Apr 2018 04:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523358167; cv=none; d=google.com; s=arc-20160816; b=05kBS+JWmBr0zaZ1Dglhr9O0yVb9Yu8YVR/E+ioC6BGHub67O3HzMH0AyZzcgpDx+m eKmESfkUCWs6bkM8oR45ViKOeQ2ZIdy2qNfA7iwxhC1S8f7mswZaBzblaJSEdOWXrJSI 6sCcIuPU/HjovnlqHT/1DVJkkKvyTvXQucpyxL9AL/0xu5aK1GBPUtpbs0M9VsJGxqqo fzc6XcMVFBjvVEdO00diC4Kdjs7az5KWfudPL+ErTWwRofwzmeq4WwwxRtUczF9A+bvw UTdb4Qlks+uy9YJSEZw2B5KVWd1EWMAFTdKlth9AGb2aK/GartHRIUKRc/3V9qggbFI3 64oA== 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=mbufvmdvgIL7iGTSAFkmpQ4WGFfDA2X2a7gguwPiXZg=; b=HNQ8mbPfpVDqFn/qitc17u68FfTUczrLwaFLKoaiaW9oy24mMJNhsx305bxA2F6vat MiS+MBsF7RuIlv7otpwQnrfTBDVmT2zILy5Kh92Q6U+6E8WtIPGeK4qpzlQJetjMWlyN ttKXnoMIFobJkJUZB+af0DRmdgY+rXU4N3z2Uge82L1xMy6hhG5Rg1xZF730/o+bDypr 9KqtsNFMfAwMEkSexQyHV+hdEsXyRuHzjzSONj9XHfLZvZr0Hh9sJX9CYy17tKfiVHQX Mti0WDMbFmOh/rtuD54CP59feV0EDxmsvuEgENZnVzDry0U/yE9v9ZYLLNyTcU8dXWQM l+zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LSindS+W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r63-v6si2399154plb.365.2018.04.10.04.02.10; Tue, 10 Apr 2018 04:02:47 -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=pass header.i=@linaro.org header.s=google header.b=LSindS+W; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752855AbeDJK4L (ORCPT + 99 others); Tue, 10 Apr 2018 06:56:11 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:37524 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942AbeDJK4K (ORCPT ); Tue, 10 Apr 2018 06:56:10 -0400 Received: by mail-pl0-f66.google.com with SMTP id v5-v6so7235365plo.4 for ; Tue, 10 Apr 2018 03:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mbufvmdvgIL7iGTSAFkmpQ4WGFfDA2X2a7gguwPiXZg=; b=LSindS+W3tNFbTUx9fV1yzP08C3YT16JMLMCxELDyAxKUJjZ6cDwa9vvVRjB3dvf94 9yPSLIzG0x1aw8iD8e+SkNSk938P1hcAjmwdIvAfAznK1iFYk9epPeG1urPEnuX9F7Fb +Hm/X8MDvC5FkvbeRyQEvGRL9pTjxBS+TNva4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mbufvmdvgIL7iGTSAFkmpQ4WGFfDA2X2a7gguwPiXZg=; b=rusTpXYLnsVnHZIrMsgw+OqRdriwH9JVzK57MDJTIjL31MrmjjFOxPRxIfGN33AzgG w8BkO6mNZXPhZrpiaqHOShDf4vK6naE4NPcrU6FIhQ+eoDfZe1ttsGXtkfp2Q988meTJ fkTkB6zP+zVpfwkqH+iZa7kmgiOB2J/iXs98jVpOOTZdmiozDZzyEzEcXPBL1F/Ony+K rtLJ3rEbsPfGkLckuQy1dUcRL2egUDa3YE3mZIEmyQsFHG/gaxDKCGbEYOcXWw7biZ8Y cFwQXU6crZhKdbXzDMKK26BpTxugodZdJKlviSTjPhuTWl76tHpdRa+za6LGWDE1rZbZ U2sA== X-Gm-Message-State: AElRT7H/LtXTP2Ffe9dcYerOH0MgucZX8VtHvQeI6vuzM8MdK8w4gl8u mB1uPCJQ2LyBPlDxmLwxtw6+cA== X-Received: by 2002:a17:902:c6:: with SMTP id a64-v6mr42526241pla.408.1523357769620; Tue, 10 Apr 2018 03:56:09 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id j19sm4638496pfn.29.2018.04.10.03.56.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 03:56:08 -0700 (PDT) Date: Tue, 10 Apr 2018 16:26:06 +0530 From: Viresh Kumar To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH] cpufreq/schedutil: Cleanup and document iowait boost Message-ID: <20180410105606.GH7671@vireshk-i7> References: <20180328090721.26068-1-patrick.bellasi@arm.com> <20180405095858.GP3572@vireshk-i7> <20180410104349.GE14248@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410104349.GE14248@e110439-lin> 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 10-04-18, 11:43, Patrick Bellasi wrote: > On 05-Apr 15:28, Viresh Kumar wrote: > What about this new version for the two functions, > just compile tested: > > ---8<--- > > static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, > unsigned int flags) > { > bool iowait = flags & SCHED_CPUFREQ_IOWAIT; > > /* Reset boost if the CPU appears to have been idle enough */ > if (sg_cpu->iowait_boost) { > s64 delta_ns = time - sg_cpu->last_update; > > if (delta_ns > TICK_NSEC) { > sg_cpu->iowait_boost = iowait > ? sg_cpu->sg_policy->policy->min : 0; Yeah, I see you are trying to optimize it a bit here but this makes things more confusing I would say :) I would just set iowait_boost to 0 and drop the return; from below and let the code fall through and reach the end of this routine. > sg_cpu->iowait_boost_pending = iowait; > return; > } > } > > /* Boost only tasks waking up after IO */ > if (!iowait) > return; > > /* Ensure IO boost doubles only one time at each frequency increase */ > if (sg_cpu->iowait_boost_pending) > return; > sg_cpu->iowait_boost_pending = true; > > /* Double the IO boost at each frequency increase */ > if (sg_cpu->iowait_boost) { > sg_cpu->iowait_boost <<= 1; > if (sg_cpu->iowait_boost > sg_cpu->iowait_boost_max) > sg_cpu->iowait_boost = sg_cpu->iowait_boost_max; > return; > } > > /* At first wakeup after IO, start with minimum boost */ > sg_cpu->iowait_boost = sg_cpu->sg_policy->policy->min; > } > > static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, > unsigned long *util, unsigned long *max) > { > unsigned int boost_util, boost_max; > > /* No IOWait boost active */ > if (!sg_cpu->iowait_boost) > return; > > /* An IO waiting task has just woken up, use the boost value */ > if (sg_cpu->iowait_boost_pending) { > sg_cpu->iowait_boost_pending = false; > } else { > /* Reduce the boost value otherwise */ > sg_cpu->iowait_boost >>= 1; > if (sg_cpu->iowait_boost < sg_cpu->sg_policy->policy->min) { > sg_cpu->iowait_boost = 0; > return; > } > } > > boost_util = sg_cpu->iowait_boost; > boost_max = sg_cpu->iowait_boost_max; > > /* > * A CPU is boosted only if its current utilization is smaller then > * the current IO boost level. > */ > if (*util * boost_max < *max * boost_util) { > *util = boost_util; > *max = boost_max; > } > } So this is quite different than what you proposed, it is only fixing the existing problem which I pointed out to. Looks fine, not much changed really from the current state of code. -- viresh