Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp132376imm; Mon, 21 May 2018 03:34:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq+q2X/pJyyzA7ggkkcwNWMF60ZotX62XEPojjA3BgA7fU49IrYO5M+Vdnq6+h67Ye1INAn X-Received: by 2002:a62:e04c:: with SMTP id f73-v6mr19560639pfh.88.1526898849258; Mon, 21 May 2018 03:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526898849; cv=none; d=google.com; s=arc-20160816; b=KdM7vte/FJV5GKERQ2SDQ0f3XfcONN9mJhPUteW4dTg8Kak6W/oBQy7d9yCVHRmcqX mEchcPZkQURc9MnVJETt3p+k4E4Jgn4D55kBIVDrw6Ex4sWguLWASEwICfQKE8EVyFMv sQ6kKoTljMI7tVksPh7RwCkfsI8biGNB3eEaWIHoaxh+69dpG2AwByDg8Afc19no5g6O jkpC+rduesLNJ8Cgx6exIp9c2ql4zFA3F6Z5FOsMnTyO9MNLUnGH5RfouNBylk/RhmNU EL+vBMdvQxgrynNudsxw0363EvGYnU/OYhngeeIntj00g6/woq8CxB6Xv1w3gCpCKgLP PkRg== 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=KcW0Cb0vLlj5+qKNH3T5NtpB5IcFAeUAKFjL2DwjOxo=; b=Hc8GW9jDR5atS1mh0mCguQYXTad8OWLuaZUZJvvmpjKOxoO5FkfhsCx8pupQ/6VaNU Bu/hkcIkOE+YiXalfD+ajxTs5yUprvARjI0bfBu1KXcrsCnlY+raqxKDTjzvk+r1igmt bpkdX80utRdK6F9cBbjTzEs2rNDW+V+T3ycZ/yEGbo0eqruubldizZK7jdkqO4Uav7W1 sP4ScUdfgYlNn1MZ1iyIEmZtwpKfoqPKmXuPwLsk0cQDpNalT3TiYgJ8grlALN6KefRA 5lg1bGC6CqyEl00JnY1Xo7yC/q70oQVL6Wexre0fOfnRUGbwe1+POuldXVpiGz04u7h0 zzBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQPWi8PN; 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 m4-v6si13524949plt.561.2018.05.21.03.33.55; Mon, 21 May 2018 03:34:09 -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=jQPWi8PN; 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 S1752713AbeEUKdC (ORCPT + 99 others); Mon, 21 May 2018 06:33:02 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:43457 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673AbeEUKdA (ORCPT ); Mon, 21 May 2018 06:33:00 -0400 Received: by mail-pl0-f67.google.com with SMTP id c41-v6so8554015plj.10 for ; Mon, 21 May 2018 03:32: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=KcW0Cb0vLlj5+qKNH3T5NtpB5IcFAeUAKFjL2DwjOxo=; b=jQPWi8PNLG8wiel2TmfXCFizZA9H1Wj00xtw3OKeqTw4SyUWMGtLU0FHVpwmvadfQW gpVgoaNeWZFKePY9bw4J2k28vdcEuk/QgqHH2n7drxv6yBVhXZb90MRg/DqCVi+HVWPA A5OJdm8ywbAuS0fvAbimRnwkP5mhAiPfwvRXg= 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=KcW0Cb0vLlj5+qKNH3T5NtpB5IcFAeUAKFjL2DwjOxo=; b=OZB42Tqwy4xPo+mHkENmYDViwRV9c/57xziAOiZoWoavZBHcIwtMZfuXCl848IZYuN DLiWXdXGaAnJz06tfDqphKpEZxKuh+7WQfR239MuhVg7qNJiezLmVOpudvKVJE49KhtX Tr4ZqbGaLSacSlD7PkPf2n+oyY8bHJj1/xl/ZLUE08BFPTKaaYNbO7Q5RcMgquKoYYFP rBdN4825ojJmq2kKXpCI0uG/hwlVv2N9jLh+dt6Mcm98kBq0fYjFHMMPXVLU1Ndg+trk h1z5eaz8F2qtFrBP+e6EnyPhaSAuk29JMgXBbQJ7ToSGEfh5nvc2B2V+0x3vQtOSHgI6 tjuQ== X-Gm-Message-State: ALKqPwcpCuoAX5CuaswqJilK1YtlyVF52tBI3QjMiQkmjEXZLWz26A9S NGCJkZsCFBBDDGyl9uCF+OiR7yrB44k= X-Received: by 2002:a17:902:1c8:: with SMTP id b66-v6mr19419612plb.156.1526898779516; Mon, 21 May 2018 03:32:59 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id r8-v6sm25289092pfk.179.2018.05.21.03.32.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 03:32:58 -0700 (PDT) Date: Mon, 21 May 2018 16:02:56 +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: <20180521103256.l7bva6bfy765mqwh@vireshk-i7> References: <20180521085120.7902-1-patrick.bellasi@arm.com> <20180521085120.7902-3-patrick.bellasi@arm.com> <20180521095255.h62pdcf34bh344wu@vireshk-i7> <20180521101108.GP30654@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521101108.GP30654@e110439-lin> 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, 11:11, Patrick Bellasi wrote: > 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. Okay for both. -- viresh