Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp818845imm; Wed, 8 Aug 2018 06:20:22 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwwgkpOE2KdYFGFKX1sWQ9dZRnD0KjZigkN/aYvh1BiHK+02LQCN8VdZkOdirFfNNQG1enP X-Received: by 2002:a63:1c5f:: with SMTP id c31-v6mr2630881pgm.321.1533734421984; Wed, 08 Aug 2018 06:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533734421; cv=none; d=google.com; s=arc-20160816; b=pJqsx+Gvjlg4ZWXkpKAp8bkLbek032GV95ub5+OggGvbpL7x2rU7Wzzci6nG64OQ1L gZpUW5m1PBj6rnEGxSHceVK+iDLB+Ga3KbjHPlJ9ctLzgMV5Y2U0fV3DsUC6IjZMjSND 7qalQWfuMZKlNBzX4bjVWmMtszocBLWEvxAmWJjhgJ24LxrGE/xB5ipAPEclGdWwNWI8 NjZjaMa+PVAw8eXcyjl+kxpSEv4ivWT7xnFXq9f7CiyK/oX6l7ff1pmJDYSEES1S13rk SNSRV/fqQFBy6y8veZPY8Bhzp3xIimjKwgl4OCDTq8V3vTntntDnyuNzpHUoA7tOoGKr jN8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=rzM4TrpRj2WFQprRLUbO9Sq5ONQW8yf96gmBhYgVTwA=; b=ky+Z0/lZuJ/THNKrN4sjxPyaXzXu3IGjXUZKCJuTl8erW2Esy2GHbxZoXvVqidDeZZ b5MkyDvB5z/XGZLfeSRKkSkkWBx2T+JvdYpUfkq6haWZtp/hFBChf8mlaRhXTZ7ipNMq UIxaeq+FjWr2DTL0uFG5imH5IpVXBvOBySHzLIqoeH8PqRlnEHux9z8Gw5OUcCrbZ6lM LTEzVYecpWIxucSgFRlU3SQfI/4zpW5aZg2VMGS8LiyabkxBe/kastMbdDLVR4En2u37 yYWkNGUjWxPc5QwxGL398YZpr463clbLG3I/HYVGUDGUbsbGvxTvNRprzjvdDgM3Rp0S duVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SlJgbUVp; 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 s184-v6si4107727pgb.123.2018.08.08.06.20.07; Wed, 08 Aug 2018 06:20:21 -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=SlJgbUVp; 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 S1727240AbeHHPiv (ORCPT + 99 others); Wed, 8 Aug 2018 11:38:51 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:38010 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727130AbeHHPiv (ORCPT ); Wed, 8 Aug 2018 11:38:51 -0400 Received: by mail-it0-f65.google.com with SMTP id v71-v6so3493781itb.3 for ; Wed, 08 Aug 2018 06:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rzM4TrpRj2WFQprRLUbO9Sq5ONQW8yf96gmBhYgVTwA=; b=SlJgbUVp5J/L/trhm1E4X4HPgYTfJs1KwnDkH3DBJLaDJK/4bgFHVT/9ZmAsYNCh7/ 3Ftcmsf7/wliBC4geaXkfZ5P8EbE52rdAa6ziR2rFRn1OSYelcJACrN1ojlNWPp2y8up 1Xsu4DZlMbNaM91PPsF7ZDnpWmVkwohpGX9w8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rzM4TrpRj2WFQprRLUbO9Sq5ONQW8yf96gmBhYgVTwA=; b=Y2It6xmmM8KHrP4H4StQSTEXKVMRsC4SJgmsFoICVRIwQMrLGDI5ahaugtOoUbxtxv OudtweGEyAo8Ml7HpHB2H7HdCrii9U5hpS0dSd1XTOA8DLUf9y1NIq5HvVadyllznBXB xydjg/l/yU1++RvwXCK8odAFFrRK5z/htCKmyAUkHDFifyHbTK4vM/kP6s1kr9/SS1HE 7PRZ8Da8x9DFIimbZC03H0hOZTB9muDkQy46+aYqW57d6VL6hLYxiwKvRAu5JJYZ1o+p mvC9kTdmSvo0eEe6budcK0grE57venCdgvBOM4H4HgTZH+aP7dDVv1GDOBeqDpva643M AUOw== X-Gm-Message-State: AOUpUlGIHmfkgq+/yKgYf32e+T64G9Z38WcZllDVZPw4JM5Q29glYRES PJvX4xLv2gqDudw/EoPjFxjZYl9pDJ92nuv8H4Jmrw== X-Received: by 2002:a02:4c16:: with SMTP id a22-v6mr2299375jab.48.1533734351105; Wed, 08 Aug 2018 06:19:11 -0700 (PDT) MIME-Version: 1.0 References: <20180806163946.28380-1-patrick.bellasi@arm.com> <20180806163946.28380-6-patrick.bellasi@arm.com> In-Reply-To: <20180806163946.28380-6-patrick.bellasi@arm.com> From: Vincent Guittot Date: Wed, 8 Aug 2018 15:18:59 +0200 Message-ID: Subject: Re: [PATCH v3 05/14] sched/cpufreq: uclamp: add utilization clamping for FAIR tasks To: Patrick Bellasi Cc: linux-kernel , "open list:THERMAL" , Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J. Wysocki" , viresh kumar , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , "Cc: Steve Muckle" , surenb@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Patrick, On Mon, 6 Aug 2018 at 18:40, Patrick Bellasi wrote: > > @@ -222,8 +222,13 @@ static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu) > util = cpu_util_cfs(rq); > + if (util) > + util = uclamp_util(cpu_of(rq), util); > util += cpu_util_rt(rq); > > /* > @@ -322,11 +328,24 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, > + max_boost = sg_cpu->iowait_boost_max; > + if (!cpu_util_rt(cpu_rq(sg_cpu->cpu))) > + max_boost = uclamp_util(sg_cpu->cpu, max_boost); > + > +static inline unsigned int uclamp_value(unsigned int cpu, int clamp_id) > +{ > + struct uclamp_cpu *uc_cpu = &cpu_rq(cpu)->uclamp; > + > + if (uc_cpu->value[clamp_id] == UCLAMP_NOT_VALID) > + return uclamp_none(clamp_id); > + > + return uc_cpu->value[clamp_id]; > +} > + > +static inline unsigned int uclamp_util(unsigned int cpu, unsigned int util) using struct *rq rq instead of cpu as parameter would align uclamp_util() interface with other cpu_util_*() interface and remove some cpu_of(rq) and cpu_rq(cpu) > +{ > + unsigned int min_util = uclamp_value(cpu, UCLAMP_MIN); > + unsigned int max_util = uclamp_value(cpu, UCLAMP_MAX); > + > + return clamp(util, min_util, max_util); > +}