Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp112905imm; Mon, 21 May 2018 03:13:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRImDGiirAKxNy1gRvFMTdN2O3uCZF0YJUy5XTiS/YyWovtT5yQhIAUgwQT7vk7x5Fzrs7 X-Received: by 2002:a65:668e:: with SMTP id b14-v6mr10018194pgw.172.1526897588792; Mon, 21 May 2018 03:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526897588; cv=none; d=google.com; s=arc-20160816; b=K+yubQv/+pvxvxDkulSWGLXqQOrZEzVwmI+DCsdh+tB/ACgTNslQeW8nzzL4e+ApAD XaIkWz8dwSthufXf7sSOVy+Jn5D6Zg06KBX9Vg1GiuhSkKS/IqD/CY27/sxKpzo31hpp PM4zewaFq/1UOdvsUR/tVIRhtjGdGZmKI27+PFB6RJAvJX0/TjGGnKX0fMv70uqi6BTY 3W3waOmauK9ShJFxnt60KjRXi5XI1cnWhpzZjZVnas10kKmvCcpWSS1Efnoe+dJd8pGe otN6bO+LfL0JR/UC4lKuGeXbg917DjdRi6ZUhqtr0eylp9gxGQ+sNYbKHQjr6guYu+Uf bWeA== 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=d+lLahsGsTjvbmnOx4vrY0udrpq4lAZFpmIBbgVXaV8=; b=rV7p9o+829C9pfLie89tMpZl6pgeA4uNkft4Wg6JGUHnQ9hy0M2rd1j5B4DKor+g0u hRTHQfHIBGfBPqDbiTzTEksgMqZzu7D+ffGWYqVVuStyAurhTI4ZcoalXryhTvWCG3MU zJa2u04kpptENBF0upCY32v/cWKm8RcU35SJ+i90VgX9TZrnXr+P0McVEp0u+K73cB26 8DsEqffOttsrbn2Fp+RwnZJOPkUx0khjXf+JGFxrEJbNMS8l0ZYaGnvmfeJnGQlVoiFN NEjxVmlBTkf4vkYMFNnnG8ethvFCbUiwNE3dY95Wh8ESTyDKfOFE476O/sL815XTBlOi 9x3g== 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 g63-v6si14187126pfd.93.2018.05.21.03.12.54; Mon, 21 May 2018 03:13:08 -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; 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 S1751915AbeEUKLR (ORCPT + 99 others); Mon, 21 May 2018 06:11:17 -0400 Received: from foss.arm.com ([217.140.101.70]:46128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbeEUKLN (ORCPT ); Mon, 21 May 2018 06:11:13 -0400 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 3FDD11435; Mon, 21 May 2018 03:11:13 -0700 (PDT) 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 750A23F25D; Mon, 21 May 2018 03:11:11 -0700 (PDT) Date: Mon, 21 May 2018 11:11:08 +0100 From: Patrick Bellasi To: Viresh Kumar 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: <20180521101108.GP30654@e110439-lin> References: <20180521085120.7902-1-patrick.bellasi@arm.com> <20180521085120.7902-3-patrick.bellasi@arm.com> <20180521095255.h62pdcf34bh344wu@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521095255.h62pdcf34bh344wu@vireshk-i7> 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 21-May 15:22, Viresh Kumar wrote: > 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 ? If not "mandatory", I would prefer as it is: I'm running with a small stack size in my mind. :) This "bail out of a function as soon as possible" template allows me to see immediately that, for example in this function, once we decided to double the boost value there is anything more to do here. At the same time, the statement below it reads as the function default action. Does it make any sense? [...] > > + /* > > + * 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 ? I've removed it because the above comment now refers to all these lines together. > > if (*util * boost_max < *max * boost_util) { > > *util = boost_util; > > *max = boost_max; > > Otherwise looks good. > > Acked-by: Viresh Kumar Cheers -- #include Patrick Bellasi