Received: by 10.192.165.156 with SMTP id m28csp560180imm; Fri, 13 Apr 2018 04:05:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Q8+oEs8WqR9b39lH1epm59Pu837SnUZE4NM/1dbIjya4mFksZD7L7Ew8Ojn+7ti1Htbn7 X-Received: by 2002:a17:902:ba88:: with SMTP id k8-v6mr4720654pls.305.1523617553108; Fri, 13 Apr 2018 04:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523617553; cv=none; d=google.com; s=arc-20160816; b=iRFmqk25QIJmO5XIzAdBkllvODWsNHw6CAqmqCwRppZ7SFQvzcKPQ2X/TmQiv/OU7Z lxTzcU0EsqFXBiPdq2go+y/5YDCu5KCzPs7sAxdIObEsL9FrQuYPEe7y5+6lzBnW3h2o OSK52ZB0PSAXZ+Ya9i3rVc/q0Nj9NFG0dQNXj1EmhqiN+gFRjNxc+9QjV6VWyw11guzm jOAooWtuOr6/4U2DfxupH0GOQattnPnfXTOxLagfGC3+/WtoxKF+oKDDMceARKw3ojdm kJjUw6P4uATkWzqLgpepsvVVPZ6gBiaTNH3w8GhBqXCqvJ0xxyY8GlLoDuucqghQAX4T SxQQ== 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=/zk30Chyl/s+zMLXPmbUlzIYFu8rt8oRZ5uqS3sYQ8M=; b=N9Yn+p6uvfZyz8GXOX03ejeXfjOBLY9nHD4BxEyk8uzWrH45sIUYiaRatMIIPxENz4 3nANL2ZEqQRWUdNU8jMen3ZxhScsj4dgJzb8xr2w7xb0hCbtHZxEkwjCfxr2PW9kph7O XZTRH+FLy7TxCsXnIi9UqF0+rjNpAyCli1uTVXGztHQ0bqRvhKCuoLRwkLqAxs4TmufC AIUEJ4hoOx+/X2fv/J9wHxZ6Pek4BsHLncHy6QKnOzJIY7i6hjyOHMmsL5JgvcqrzX7n 47B+3C2Q4xRowSiR3cvde3Ke0lzlAjawYkfRiSyOQvfg3LfU8TAMeoS33dXJQpmjK9la 4NwA== 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 x7si658426pgq.250.2018.04.13.04.05.39; Fri, 13 Apr 2018 04:05:53 -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 S1754092AbeDMLEd (ORCPT + 99 others); Fri, 13 Apr 2018 07:04:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41292 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753784AbeDMLEb (ORCPT ); Fri, 13 Apr 2018 07:04:31 -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 932F21435; Fri, 13 Apr 2018 04:04:31 -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 CA7943F24A; Fri, 13 Apr 2018 04:04:28 -0700 (PDT) Date: Fri, 13 Apr 2018 12:04:26 +0100 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Joel Fernandes , Steve Muckle Subject: Re: [PATCH 1/7] sched/core: uclamp: add CPU clamp groups accounting Message-ID: <20180413110426.GQ14248@e110439-lin> References: <20180409165615.2326-1-patrick.bellasi@arm.com> <20180409165615.2326-2-patrick.bellasi@arm.com> <20180413082648.GP4043@hirez.programming.kicks-ass.net> <20180413102202.GN4129@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180413102202.GN4129@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 13-Apr 12:22, Peter Zijlstra wrote: > On Fri, Apr 13, 2018 at 10:26:48AM +0200, Peter Zijlstra wrote: > > On Mon, Apr 09, 2018 at 05:56:09PM +0100, Patrick Bellasi wrote: > > > +static inline void uclamp_cpu_get(struct task_struct *p, int cpu, int clamp_id) > > > +{ > > > + struct uclamp_cpu *uc_cpu = &cpu_rq(cpu)->uclamp[clamp_id]; > > > > > +static inline void uclamp_cpu_put(struct task_struct *p, int cpu, int clamp_id) > > > +{ > > > + struct uclamp_cpu *uc_cpu = &cpu_rq(cpu)->uclamp[clamp_id]; > > > > That all seems daft, since you already have rq at the call site. > > > > > +static inline void uclamp_task_update(struct rq *rq, struct task_struct *p) > > > +{ > > > + int cpu = cpu_of(rq); > > > + int clamp_id; > > > + > > > + /* The idle task does not affect CPU's clamps */ > > > + if (unlikely(p->sched_class == &idle_sched_class)) > > > + return; > > > + /* DEADLINE tasks do not affect CPU's clamps */ > > > + if (unlikely(p->sched_class == &dl_sched_class)) > > > + return; > > > > This is wrong; it misses the stop_sched_class. > > > > And since you're looking at sched_class anyway, maybe put a marker in > > there: > > > > if (!p->sched_class->has_clamping) > > return; > > Alternatively, we could simply add uclamp_task_{en,de}queue() into > {en,de}queue_task_{fair,rt}(). I like better your first proposal, I think it makes sense to factor out in core code used by both RT and FAIR the same way. Do you have a strong preference? > > > + for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) { > > > + if (uclamp_task_affects(p, clamp_id)) > > > + uclamp_cpu_put(p, cpu, clamp_id); > > > + else > > > + uclamp_cpu_get(p, cpu, clamp_id); > > > + } > > > +} -- #include Patrick Bellasi