Received: by 10.192.165.156 with SMTP id m28csp428733imm; Fri, 13 Apr 2018 01:29:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ijjI2/XEkiXJsQNeQAcwISsPgHYSoUKar3vngNtCtRpIn5ttzIlk1LRjPxq+f47AFJIGN X-Received: by 10.98.59.4 with SMTP id i4mr10679989pfa.26.1523608149248; Fri, 13 Apr 2018 01:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523608149; cv=none; d=google.com; s=arc-20160816; b=xDSmbU0C+yEImJ7gfmd46KXAj22/9K38AIN/EKA8BnvZA29jsVxTHHxoBKP8I70mGy VILBcD0dNm12b4DIeqMqo8O2MFITlpds+IITBT2Uhjm70qts3W3mwH0O16Wm+r8Z2sEm 6BqMrFuZ18EQGCUGNNjw3d7QSH/702SLqpVRFc/G1hnybO+V2RBb9rv+tGwq00asdSw1 kscrgDtxIgezElYK/OojmTS5mPF9fhoHP5PYFv10vnRkGwDBK9RiifeafflhoLMGOcqR nkUbMV9lbZrzht9Xqu1GmKwfspr1JeZhP9v3uno4+i5mz5kO7CTwT71PeXILolG4xar0 G7rQ== 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=HV5aNcgvkVp4kwnXAIWoRjwMohZd8R5+nwDV4oe5t6Y=; b=lUPLVwIXuxSagvdbZc1aSiwfvH/i1me+4AWrIqaUZPbPeFlihg+fkfBF0Pz7rRJZvM Hx+g/+1Ppn2IRuoZ4Exm8aKR+MbQdBLBbA668e28XSu6L5GKHh+yhcEFHoM+1HlcTJTr KVCckbCxtuZTGf3OQWKnT2efRDkn7z7+I252teUaFmW0qbsfjjvCEMDeBmhnvkRCaKDl OThd0iu60vTzpdxPkcZ2S5hhbmBOrZc2m91HNwkEQFSZtGlxzV5FvXn/Fq31WweFX5HS /fsegDQMYGOSPoMfyu0esJVt8D5dVEmFEQtErOpgdq72y3Qcl8IKe3oK2KILNBlngDTS lwWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Nfajozjp; 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 v7si4173384pfi.28.2018.04.13.01.28.55; Fri, 13 Apr 2018 01:29:09 -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=merlin.20170209 header.b=Nfajozjp; 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 S1753949AbeDMI1M (ORCPT + 99 others); Fri, 13 Apr 2018 04:27:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:35776 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122AbeDMI1H (ORCPT ); Fri, 13 Apr 2018 04:27:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=HV5aNcgvkVp4kwnXAIWoRjwMohZd8R5+nwDV4oe5t6Y=; b=NfajozjpCiQHasn5uZ7UurzOE AF/GgiQ6Ug/pOI9W/WfMGem61aFcCrMIRYEGtp3FPOTlEtmjPeeGr5yi8bVNnOqo5A2rej0Pa4dD+ G9bZDKLLYUhkhzxvyEeMW3EE7IOjOvHK+Ia5SsGEcXSOnnHSs/BSNwCMOXuqpf6ewqum9ToK4yic2 9XMOUAATIH78K9TNhfl4WGzZAVWJ0nRZ4ZFNWendQeZERDIaAbAVvDCyMAV/L8ywYH4rKsbQOh/tj lBiCAlll5ouEk3BqGVfhJEEeov7X4XJGNF5t3LUXUGD9hLc4kMu4IkSBBJMkt/QAuTxa2LoM/VOSI Az5kWZuuw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6u2l-0003cG-Go; Fri, 13 Apr 2018 08:26:51 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B43ED2029B0F9; Fri, 13 Apr 2018 10:26:48 +0200 (CEST) Date: Fri, 13 Apr 2018 10:26:48 +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: <20180413082648.GP4043@hirez.programming.kicks-ass.net> References: <20180409165615.2326-1-patrick.bellasi@arm.com> <20180409165615.2326-2-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180409165615.2326-2-patrick.bellasi@arm.com> 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 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; > + 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); > + } > +}