Received: by 10.192.165.156 with SMTP id m28csp600193imm; Fri, 13 Apr 2018 04:49:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oXKAnmDPdc6cQH41W2iU7Yn2rZ3kGRVesUdKSSA//appJi/oxTvbvHZg2kBytxDJfJEfq X-Received: by 10.98.10.23 with SMTP id s23mr11317113pfi.204.1523620165057; Fri, 13 Apr 2018 04:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523620165; cv=none; d=google.com; s=arc-20160816; b=f/R1VgUwcXpX4v8H+xTQMu8QmLlfGk9dboqhoE9IOZsg0Nvz3uxmRT8YRjcFw08z2Q BiMZh5gDIatfOan1BHbZsRE8xxUQs5qqvwOvrKVFakeuz8UaSVq3jNwsRARMJb49tKeB l483LLIGKnQBgm/QoGLF+NqaVaRJ2iy63MDb7kE66RuubhbIIVxVLMEJf2nMwDt1BA0p 9ins1XTvQxitSLmi7zf39dsYBZRkicdWHgfNK4Gp26D/a6UfQqVceqID3Yg2hpegbseX ocSBFK3pP41q1ZXSnbjDNEVk3ru1Wt367ywpqfW77th88jf4uU7gr0WOS1U2fu4HVfp2 7vMA== 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=T93yZm7f24hGHUdY9GRVk0vI3BDGqmQxNsSqnlZxA8w=; b=JBbpsVnbbmO+fm9SbgYsAd4izXbGSOBC2IR6RZ8plWzKlRZqpAiblJAKV1OKBm60aU 59ptgBZOfuCP1ZdGP1P1blqoD2VdykmXzlttsxAvTdYKasuyTzj0tcPVIZhF2tx9RrrC E1iNwgVAm4yWJ8ahZN0znWoY5qfemLjmZmAJPjWXQEoOFCojUXBibqtgfULdDFZ6Fkiw XYtxOWcA7TE5lsAp8sR+t7tnYP57IyZ8KDRj4uVsV4ImmiPuOs4Se3GgCN3j/ilq5U2k hO1MB0bsaz/R11Ae4UChEjw3PJlc+jRo6F0PV0sOZu4G38ENM0MRHoRLfEOyJgu18lm3 lIcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jlyuqipn; 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 m14si3981289pgt.287.2018.04.13.04.49.11; Fri, 13 Apr 2018 04:49:25 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jlyuqipn; 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 S1754217AbeDMKWK (ORCPT + 99 others); Fri, 13 Apr 2018 06:22:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51410 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbeDMKWJ (ORCPT ); Fri, 13 Apr 2018 06:22:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=T93yZm7f24hGHUdY9GRVk0vI3BDGqmQxNsSqnlZxA8w=; b=jlyuqipnYUvdx3s020Be4XAhZ F8TaJkvHOJwhDOMot5XyNW6SOvV0tog5mEqKfzjTAp5D8ZR14aCglV0Wgj8FwEm/ja7zeVAikPPRc leCx37pgASvlM9DLWQDs/Nl4LQrj1OTnY1Zzq7TeLMnkiYKNWyms4YupaitckRL1pTu3u4aUPh/cg JeNNyr7R7hPqXwUzOXvtFof1m2xiqF8EO8mnzCqcHuLRlZ19KZFBEGEqpgTnUMxDSZn0x4+SxXCks LKcrxAe73vj1bvWkDJMaTO3iH/oxgVy99KAGbBStmygqASoYkj0SD0yf343kmZPCeQjdJVO4EBL8u 9ZQ18B5cw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6vqG-0001eI-2O; Fri, 13 Apr 2018 10:22:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1B3592029B0F9; Fri, 13 Apr 2018 12:22:02 +0200 (CEST) Date: Fri, 13 Apr 2018 12:22:02 +0200 From: Peter Zijlstra To: Patrick Bellasi 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: <20180413102202.GN4129@hirez.programming.kicks-ass.net> References: <20180409165615.2326-1-patrick.bellasi@arm.com> <20180409165615.2326-2-patrick.bellasi@arm.com> <20180413082648.GP4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180413082648.GP4043@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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}(). > > + 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); > > + } > > +}