Received: by 10.192.165.156 with SMTP id m28csp570920imm; Fri, 13 Apr 2018 04:17:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx48me3pngo36xlzbfSP9TopM3XORHgg7kGV82lxPwrckqFH4H0XmRDue/inGtNO+3u8/bG9q X-Received: by 10.98.152.22 with SMTP id q22mr11166314pfd.178.1523618225133; Fri, 13 Apr 2018 04:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523618225; cv=none; d=google.com; s=arc-20160816; b=ILjtfmnBnklUaILSNoUWx3YhB+x7Nt59T0jzvi9nVIYgTEjee/PlccC13Z/QRvYRnK LN8vXaPf5d45Dr/2CyJ4wYrQC4v1wDLti+MQYy9dshoU5JamHX44flZCgsmgogAsyDXa QFilYw4oT7fH5Nn6F212IWUe/FXnQLkQmyD1N94dnXrkG+jVy45RAfgv/RFbtIsRdGcv Nf0bw/95M8nz/UCNB43xUrjRbxKl0mKgdxZP3y5Pod10Sb6t9cdX8XLgOkIjuoyu1BF/ OsDE2D4f3XAAq7Gw5DfzWW7SHbTzg9rzPm5jGp2uqNFnQyhW6WmAL7ZWff+LFTXAbh/j Owcg== 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=CjSvvJ0afOpOLYLLzCUuOEhsv1NuzIoPSn1DP7ykNoc=; b=YoOSTKkG5il4TnOrIxQjsNcY+M6FSpGZJE8JDBorPq9D+SJjwA6ajIa/Ck2K5lKbBk Usq+A/x+5oAqHjCPbIrdYc5+Heu471lbR9ZoWV7P68PpgMWiPm32BxI9HVNlV2mSIWa7 lLW0QcStQKJZgCMPFM5J2FLnJsYBI/MtRm8boT1VvGZc4QZVRYuqNH3qF0u5SP8TZsys RYB69QRY+8KkCFLzv6QvdPT9Lk41Y1EgZlFfJUdhPe5ihk+yOG9E+OowBtolaLA870xi brR7JY1uYCw1C0I1OTGW4dlRU162aaYpZWXZX8lwWwkSikfClzzwqTUvb19pStW3itUY Djxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P9UMfVCf; 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 q1-v6si5211263plb.349.2018.04.13.04.16.51; Fri, 13 Apr 2018 04:17:05 -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=P9UMfVCf; 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 S1754079AbeDMLPh (ORCPT + 99 others); Fri, 13 Apr 2018 07:15:37 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45858 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751827AbeDMLPg (ORCPT ); Fri, 13 Apr 2018 07:15:36 -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=CjSvvJ0afOpOLYLLzCUuOEhsv1NuzIoPSn1DP7ykNoc=; b=P9UMfVCfnbOlSHkHvkBex6ypY /5/D9pamvtmqAz6Ajo24JcqYIz4hyJUnp2rsNwJnEhWGbGIMZS4arCkypSMLtunGrWU1DqohlE4tp 6/tMnc4w1xu/gc/gQ/ibUe5KzykqLyJWzgb09cgj4gEwGN9K16g92Twc/K2jvrXi7sv0r3EGrtRTh ypO6cxqYlcYhmzu059PGMyauR1AnMgnR9Ueqc7/OnhtOeF7gxhrJNN9p4hUow59YuIhUsXxJsY5FA OP5tVtcqR58+jIpInnJxMbfufb0sxnGhs0n/gCC4Iy6cyPsufxNhIrpnoW+4NEWgCr2Ds5Et4xVz1 bJ0x1kUFg==; 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 1f6wg0-0000Ym-Qh; Fri, 13 Apr 2018 11:15:32 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 14B442029908D; Fri, 13 Apr 2018 13:15:31 +0200 (CEST) Date: Fri, 13 Apr 2018 13:15:31 +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: <20180413111531.GE4082@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> <20180413102202.GN4129@hirez.programming.kicks-ass.net> <20180413110426.GQ14248@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180413110426.GQ14248@e110439-lin> 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 12:04:26PM +0100, Patrick Bellasi wrote: > 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? The second is probably faster as it avoids the load+branch; then again, without LTO you'll get an actual call in return. Dunno...