Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3576191yba; Tue, 7 May 2019 03:39:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeM6cd4yS44ZU+JMl3/+FcLuEfisdWpFlpy6aJy8HwVMUopEgLPs0K+5JoPbrIrL6VUEhF X-Received: by 2002:a63:931c:: with SMTP id b28mr7230278pge.182.1557225596639; Tue, 07 May 2019 03:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557225596; cv=none; d=google.com; s=arc-20160816; b=ay0pcPnNCDNTmPSDAUJNFMZlXvniGxZFtVHzYQnSe/VUKnNDLAJIOQQGNJ3gexFpf9 l72XM9toFhqQRvpEQ3FPVoeq0kXXF6Dtp6q0TUTRkn4jNCAdaz3cPEnHvcue55oYr6U9 tBHoi2Z1RhPSnROX1ups+/1ZnQRYvkDjlzY5pPNiCQ58EU627755ufzdyOFk9DXf176t egyfimAaTvMKdURCEAzWNeRr+t6wmS0S8ltNAAqk/AJXB44qBRWpbSM8WO2ELcANqNAg gmEouQmBdw5HwMlDVIxRj+2uPaQYJ12h7+M7fB+YWJxjbmNyamEGMPbYkz73NCjRgFtw t1qQ== 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; bh=335TsvU9qmm9u/XZKEJmYmkPtDsA5MIpWsOSUFQdV24=; b=UO2U9QX7I6RVN/JES+y+WWJBbhMAKIAP5ak1kxjNOVSZIAMJyjV6YGZ8amw2VoSCy/ DhpgWK+MJGHEPr9TqeCFFVulod8r7Sw6B/MUCEMogR1SMYiaeXoUdzveUy86OttFdIDO QBYzxHj1QDb0hT/BBo4MV4Q8b94tROXv7DP4f28GwjgkoOh5/qa2lPp5UmEcq5TVcS95 sl3eMqTINDHIg3mflIf4rO4xxTDCqzXG8ElAuWa5E6qp3dlROvM6xE2pe5Jzr8amMHs/ XBWJuKguuegLyz47nhynkM4ub+4vhN4mTDxbt4MGyPuyRndSVSJpofDKYMG71IpDI/ep uipw== 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 o19si14466192pfi.106.2019.05.07.03.39.40; Tue, 07 May 2019 03:39:56 -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 S1726677AbfEGKiv (ORCPT + 99 others); Tue, 7 May 2019 06:38:51 -0400 Received: from foss.arm.com ([217.140.101.70]:49674 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbfEGKiv (ORCPT ); Tue, 7 May 2019 06:38:51 -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 9B637374; Tue, 7 May 2019 03:38:50 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A21333F5AF; Tue, 7 May 2019 03:38:47 -0700 (PDT) Date: Tue, 7 May 2019 11:38:45 +0100 From: Patrick Bellasi To: Suren Baghdasaryan Cc: LKML , linux-pm@vger.kernel.org, linux-api@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v8 04/16] sched/core: uclamp: Add system default clamps Message-ID: <20190507103845.tejg55wfsu3l3jwh@e110439-lin> References: <20190402104153.25404-1-patrick.bellasi@arm.com> <20190402104153.25404-5-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-Apr 17:51, Suren Baghdasaryan wrote: > On Tue, Apr 2, 2019 at 3:42 AM Patrick Bellasi wrote: [...] > > +/* > > + * The effective clamp bucket index of a task depends on, by increasing > > + * priority: > > + * - the task specific clamp value, when explicitly requested from userspace > > + * - the system default clamp value, defined by the sysadmin > > + */ > > +static inline struct uclamp_se > > +uclamp_eff_get(struct task_struct *p, unsigned int clamp_id) > > +{ > > + struct uclamp_se uc_req = p->uclamp_req[clamp_id]; > > + struct uclamp_se uc_max = uclamp_default[clamp_id]; > > + > > + /* System default restrictions always apply */ > > + if (unlikely(uc_req.value > uc_max.value)) > > + return uc_max; > > + > > + return uc_req; > > +} > > + > > +static inline unsigned int > > +uclamp_eff_bucket_id(struct task_struct *p, unsigned int clamp_id) > > This function is not used anywhere AFAIKT. Right, this is the dual of uclamp_eff_value() but, since we don't actually use it in the corrent code, let's remove it and keep only the latter. > uclamp_eff_bucket_id() and > uclamp_eff_value() look very similar, maybe they can be combined into > one function returning struct uclamp_se? I would prefer not since at the callsites of uclamp_eff_value() we actually need just the value. > > +{ > > + struct uclamp_se uc_eff; > > + > > + /* Task currently refcounted: use back-annotated (effective) bucket */ > > + if (p->uclamp[clamp_id].active) > > + return p->uclamp[clamp_id].bucket_id; > > + > > + uc_eff = uclamp_eff_get(p, clamp_id); > > + > > + return uc_eff.bucket_id; > > +} > > + > > +unsigned int uclamp_eff_value(struct task_struct *p, unsigned int clamp_id) > > +{ > > + struct uclamp_se uc_eff; > > + > > + /* Task currently refcounted: use back-annotated (effective) value */ > > + if (p->uclamp[clamp_id].active) > > + return p->uclamp[clamp_id].value; > > + > > + uc_eff = uclamp_eff_get(p, clamp_id); > > + > > + return uc_eff.value; > > +} > > + -- #include Patrick Bellasi