Received: by 10.192.165.156 with SMTP id m28csp559697imm; Wed, 11 Apr 2018 03:48:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+urmBhoVSXPl+qlN0MjJJ4g04PBF/2NAVqvtNllszO+nzZ+HbF/XXRFo3nX9/AwdZ3x7/ X-Received: by 10.101.99.193 with SMTP id n1mr3046872pgv.446.1523443720701; Wed, 11 Apr 2018 03:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523443720; cv=none; d=google.com; s=arc-20160816; b=fQ4OELWcIDCdW3DODOCFCe+NYaLssAa5nYzyu3UHZabHzYTXNDZlkp9s+aY5cieC99 TsYN9t9GgLM82BzjAbEc4Qdn8x9i5qhOxKFzF9kV5A9T+bRk6M54Cuo8svjfz/Vm1mlx q6aS/uDrxgheBcxG2k9F9/HTtxhKY3+ZZH+wns1PbWVeti3ZzXiW+gvZFexYo0DAx780 x1hZEKy9PcSLQDxuHNjAh+IZ6ibd4ox7RoaUvSB6gQ/dzFmJCs71imP67DjSYqSloA3B yvTsIZFqocW/3tbeVn4Eo7f3zXCChGGVCOYwuy+hR3qp9OThzZYb365PJ/n5R4qv20J2 zhcA== 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=iSQICxYblYwJUUlQH0qqFZ6E7X5nxNdAb+Sa2f/sbWA=; b=EQBatm4kf0AoIpOgft/3680XmqLMxfP7zR/9pGBaVY/iGMuuSFkdeawyIpb8eFDi0T 1ffeI5rnIiwtFzdH2MKbKFR4WGnG58hvnP/sSGWMh64MHI39rgTRLth4iyvrRFTrA5N8 gt/HhMgaObfS0K0NrYkbVOQZsR3KpF0C6mT4+WH2MPrtbrv3Sli/i4M66L+sit2LMzdP yjAZHE3Q8NJEccUiKRY6bbkv6iGB7cIc9EJNSaTi6g3eIaX3mfypiGFBuF5V7orHHRR9 5wveLRm9yJZzmKZhQZOKXIIVb3I3P5t92OGlJTMq15a2WLlgv6536JaQWNCfrw9hR0I8 2oqA== 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 l30si523214pgc.56.2018.04.11.03.48.04; Wed, 11 Apr 2018 03:48:40 -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 S1752621AbeDKKov (ORCPT + 99 others); Wed, 11 Apr 2018 06:44:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47926 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbeDKKot (ORCPT ); Wed, 11 Apr 2018 06:44:49 -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 924491529; Wed, 11 Apr 2018 03:44:49 -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 ADAEB3F587; Wed, 11 Apr 2018 03:44:47 -0700 (PDT) Date: Wed, 11 Apr 2018 11:44:45 +0100 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Joel Fernandes , Steve Muckle , Juri Lelli , Dietmar Eggemann Subject: Re: [PATCH v2] cpufreq/schedutil: Cleanup, document and fix iowait boost Message-ID: <20180411104445.GM14248@e110439-lin> References: <20180410155931.31973-1-patrick.bellasi@arm.com> <20180410193708.GE4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410193708.GE4043@hirez.programming.kicks-ass.net> 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-Apr 21:37, Peter Zijlstra wrote: > On Tue, Apr 10, 2018 at 04:59:31PM +0100, Patrick Bellasi wrote: > > The iowait boosting code has been recently updated to add a progressive > > boosting behavior which allows to be less aggressive in boosting tasks > > doing only sporadic IO operations, thus being more energy efficient for > > example on mobile platforms. > > > > The current code is now however a bit convoluted. Some functionalities > > (e.g. iowait boost reset) are replicated in different paths and their > > documentation is slightly misaligned. > > While your patch does seem to improve things, it still has duplicated > bits in. Eg. the TICK_NSEC clearing exists in both functions. Yes, that duplication has been added in v2 since, as Viresh pointed out, iowait boost reset was still broken for IO wait tasks waking up on a CPU idle for more then TICK_NSEC... we should probably have it on a separate patch. > > - sugov_set_iowait_boost: is now in charge only to set/increase the IO > > wait boost, every time a task wakes up from an IO wait. > > > > - sugov_iowait_boost: is now in charge to reset/reduce the IO wait > > boost, every time a sugov update is triggered, as well as > > to (eventually) enforce the currently required IO boost value. > > I'm not sold on those function names; feels like we can do better, > although I'm struggling to come up with anything sensible just now. What about something like: sugov_iowait_init() since here we are mainly initializing the iowait boost sugov_iowait_boost() since here we are mainly applying the proper boost to each cpu Although they are not really so different... > > > > if (delta_ns > TICK_NSEC) { > > + sg_cpu->iowait_boost = iowait > > + ? sg_cpu->sg_policy->policy->min : 0; > > + sg_cpu->iowait_boost_pending = iowait; > > + return; > > } > > > + if (delta_ns > TICK_NSEC) { > > + sg_cpu->iowait_boost = 0; > > + sg_cpu->iowait_boost_pending = false; > > + return; > > + } > > Looks like something we can maybe put in a helper or something. ... but we can also probably fold the two chunks above into something like: ---8<--- static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, bool iowait_boost) { s64 delta_ns = time - sg_cpu->last_update; if (delta_ns <= TICK_NSEC) return false; sg_cpu->iowait_boost = iowait_boost ? sg_cpu->sg_policy->policy->min : 0; sg_cpu->iowait_boost_pending = iowait_boost; return true; } ---8<--- -- #include Patrick Bellasi