Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp94897imm; Mon, 21 May 2018 02:53:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrD7EqjWxPq6rr0+kqjdmhLRe54i3BpbWDY5WXZNwwyNoYjUJ7JSCCoNSxdddzH8jRg2N4i X-Received: by 2002:a65:628a:: with SMTP id f10-v6mr15274591pgv.6.1526896438544; Mon, 21 May 2018 02:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526896438; cv=none; d=google.com; s=arc-20160816; b=E8y7iT4AR1yGrpKwttRmrT/iENPpcudoaTsbfHTenqQRN7/ZtuuhbywZkk6P9SRECb m/IA1CoNxaWkwVBWQCK3U8nLa31u8lR5/sgQSX2pAehRYEPJ05bvNriXdEwsrCDy+XyK s4+YOfDrWZSjBvp0VGopPE/nYtDjJHaREXmglv/WTzPQvWKLFaMN6ZpTdGWreCL58Et9 cjEIn98za8VYH7ZZsZifbehT4IV3ZvTjsbC+lM8nYoTaettltKjZtYG9jrsbuho1xmva eNpsDKbW3ciXcFAD9ZOuSalALIuZA4dc3GR8QWdijo1rhhwRtF2u9eMH4DqGIbWqznr3 mNTg== 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=RA+rX8ALnItAFtbL+ceo//n4Th5PE/Wtx6iUOO4bzYg=; b=wO3uN31Tbj1PXUxmBcud8hsdQ/iT/E2sCecnfm9AwSIkJLLMjSI/hqtxE0CsePKCvW ESHdBpLguO9ZlyfnVanceJQdZ+xYBZsclDLJnnRi0jQuOcsLdCMqUkwdlxW9bwTqFOCg 7Yh0kbwDo3OL8aI2kC08/7sgJg6J4RRfR8NSVb8VfrWC6d5VvXN+kzVDHrXDFBKmxmZC qb+2deKI8lZswsMb2x+X1vFcWY1P4XlLjrz9I2GgMM4Bav8EH2h1A1ljraZQaPPh5uAv WqMdI2jolv490x1L1hCwPXHVbKsk58x95x/1cv+TZ2mH/kbo1N9s6inY7b1l4CVUI5zp Q+CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FoWck/7r; 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 u9-v6si14164818plk.516.2018.05.21.02.53.44; Mon, 21 May 2018 02:53:58 -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=FoWck/7r; 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 S1751541AbeEUJxD (ORCPT + 99 others); Mon, 21 May 2018 05:53:03 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:41518 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbeEUJw7 (ORCPT ); Mon, 21 May 2018 05:52:59 -0400 Received: by mail-pg0-f67.google.com with SMTP id d14-v6so2553393pgv.8 for ; Mon, 21 May 2018 02:52:59 -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=RA+rX8ALnItAFtbL+ceo//n4Th5PE/Wtx6iUOO4bzYg=; b=FoWck/7rlcvKJWJnNRA2cHIJIvi/Rca3ID1+dG/iTRyej2WONOBBg5kAKxe030QAxd GJu3QmPtmUm/sbCOmTpb3z6Hp6Ud1K969SjBIL3doZ0sICZkTBRY6qwZ3ITgMag97V1N WsgvKbF/VV11wBpXdvMsV1kPUAsI+G/qEPp1M= 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=RA+rX8ALnItAFtbL+ceo//n4Th5PE/Wtx6iUOO4bzYg=; b=egXYOZF/y1gYBdzFeMxNFzM4dhk5kyheyLUB5GuexR4RIx/0lvHJ3nNKN15x57vWON zOx5aZyGyO+aJSNntAoejMLUYhsVXUkyYoZgV3ocFWFjpGHyeLe1vEvL7vkCGw1vA48v EY6OLrYeM55IfAuBG2F7ESf0FuoLrcb5ZHqbrpkYyGnnNLJi4C4OktO4wcnfoHT8t6fr sCp3IifAyK2j+h9jo4SkxYDtilsttB1eM7RxdWs4ApK/RoW5c/EIcZthiuYAun+SGJbS s87+EFnmk4UIodwTiHV5m9IGg/Pp9wT/qzKVl1I/1m746SpQW5RkZAsxFoNci6lYASMy RPdw== X-Gm-Message-State: ALKqPwf9WvAn76LGJzj/kHKKJHeM+LkIyXx6WdymEqlMfrKefYWyGpDC TNzOkM/InPLCVOAsK/P8K5SOOg== X-Received: by 2002:a63:9401:: with SMTP id m1-v6mr15223279pge.140.1526896379286; Mon, 21 May 2018 02:52:59 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id c8-v6sm22534185pfi.96.2018.05.21.02.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 02:52:58 -0700 (PDT) Date: Mon, 21 May 2018 15:22:55 +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 , Juri Lelli , Joel Fernandes Subject: Re: [PATCH v3 2/2] cpufreq: schedutil: Cleanup and document iowait boost Message-ID: <20180521095255.h62pdcf34bh344wu@vireshk-i7> References: <20180521085120.7902-1-patrick.bellasi@arm.com> <20180521085120.7902-3-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521085120.7902-3-patrick.bellasi@arm.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-05-18, 09:51, Patrick Bellasi wrote: > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > +static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, > + unsigned int flags) > +{ > + bool set_iowait_boost = flags & SCHED_CPUFREQ_IOWAIT; > + > + /* Reset boost if the CPU appears to have been idle enough */ > + if (sg_cpu->iowait_boost && > + sugov_iowait_reset(sg_cpu, time, set_iowait_boost)) > + return; > + > + /* Boost only tasks waking up after IO */ > + if (!set_iowait_boost) > + return; > + > + /* Ensure boost doubles only one time at each request */ > + if (sg_cpu->iowait_boost_pending) > + return; > + sg_cpu->iowait_boost_pending = true; > + > + /* Double the boost at each request */ > + 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; Maybe add "else" part of the if block and drop the "return" statement here ? > } > + > + /* First wakeup after IO: start with minimum boost */ > + sg_cpu->iowait_boost = sg_cpu->sg_policy->policy->min; > } > +static void sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time, > + unsigned long *util, unsigned long *max) > { > unsigned int boost_util, boost_max; > > + /* No boost currently required */ > if (!sg_cpu->iowait_boost) > return; > > + /* Reset boost if the CPU appears to have been idle enough */ > + if (sugov_iowait_reset(sg_cpu, time, false)) > + return; > + > + /* > + * An IO waiting task has just woken up: > + * allow to further double the boost value > + */ > if (sg_cpu->iowait_boost_pending) { > sg_cpu->iowait_boost_pending = false; > } else { > + /* > + * Otherwise: reduce the boost value and disable it when we > + * reach the minimum. > + */ > sg_cpu->iowait_boost >>= 1; > if (sg_cpu->iowait_boost < sg_cpu->sg_policy->policy->min) { > sg_cpu->iowait_boost = 0; > @@ -247,9 +322,12 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, unsigned long *util, > } > } > > + /* > + * Apply the current boost value: a CPU is boosted only if its current > + * utilization is smaller then the current IO boost level. > + */ > boost_util = sg_cpu->iowait_boost; > boost_max = sg_cpu->iowait_boost_max; > - Maybe keep this blank line as is ? > if (*util * boost_max < *max * boost_util) { > *util = boost_util; > *max = boost_max; Otherwise looks good. Acked-by: Viresh Kumar -- viresh