Received: by 10.192.165.156 with SMTP id m28csp499586imm; Fri, 13 Apr 2018 02:57:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4910kESmjht7jxv/6RkgfnezReeqAGn4DjpYH1ZLVw0m6ighPIXgfZgFH4WAtSSIuW5kPpV X-Received: by 10.99.1.133 with SMTP id 127mr3680216pgb.24.1523613477407; Fri, 13 Apr 2018 02:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523613477; cv=none; d=google.com; s=arc-20160816; b=mRj2/r9+wRIfgsHapGUGlqTOfIwsWiH9Jy8bnNVqfAixZhwQQ99VBaOZAhzliuUTL3 4Jwl6kotdElEAl4UD3y/gr9qLF2xRJDrpvbtoJcmB82CuOJs9DHdFLb73wYaIEGtt8OG ANGonJcTsOaMVZPkYo4rmE1ngSiOpY5R56IcA9e0It833Qos6GoaElQhsloHvDXiL46H RXL1Uk5nKqab37FtCEiZ/RitBXAc1YvYKpZiWVhQ0IPbg3RNWUCJw+1JPpyN2OF4fe7j C5GJYDjP+Wp4cQz7kPWAIYj+wS0NYSW3JXUIM5yYA96Z0CHmEBXxdNbB04i8E20tn5Np 9MvA== 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=6coBG3kGuI8HUKcTZ1sKPXHHCg3XzNUTtkjovAHyWzc=; b=OTAbY0uz1/+wyI3BcSxj1hEWkCJ4Cqb+hyYtKNFQXDzAvZ4juvHntJewZGkT+JMWmN KSdLDvUtrcTifwNlR4+FXGunbgjtQ9pyYCq+lZ0gMNEynifMKESEmxmRxW9IN4GXWj09 AaX5cNl49lW2hxfM/F9TBFTAL6vOlVjuc26xfHbXEOLQiOyOcfyAwrNR5Ljlbf702/Tq xJ/PTEpestufgfGYA81QUDF2IGvD8pqNxCB1rZ/E+dAVGtjYaS7/t7mx5n5QJJ0MTfv/ t3l42kCeD9kBLJVlOJ2rmitZiGWUb0U0RSINe6kObjJNvZtYIdUeorHVnfJ/mHd202y1 RzKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=eSeF62HT; 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 b18si4313383pfl.100.2018.04.13.02.57.43; Fri, 13 Apr 2018 02:57:57 -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=eSeF62HT; 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 S1754134AbeDMJqX (ORCPT + 99 others); Fri, 13 Apr 2018 05:46:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40338 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbeDMJqV (ORCPT ); Fri, 13 Apr 2018 05:46:21 -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=6coBG3kGuI8HUKcTZ1sKPXHHCg3XzNUTtkjovAHyWzc=; b=eSeF62HTUqSacZ9seGZjWFMR2 k9W4GzjRJkST8kOBjJ54HbAeA/qbPW0WQ8BW/jVawrcFnsdpzhLGaPsuJuTY5GgzMc0GYZh6GeXK8 MiLHNNtmd8FlVXpCx2hIssqhggudGG2Obhiy6T/9MZM4khB0LqsVHqs0+ca8suB4HgfoZyRTiKd/o 75Ouoa0TH74A65/us+4jJjszCQanj25oTKayyqc+8ThFE/2kk93wxIUrbLl4HyF6H2OuhfQwK+Y7x IqUVUXOKumPFFy/17A0XX4VXuliEYbRFqrYYFAnE0ezYxgNr/W6YEphtS8qOIBX0xxQllyOH+bAYd m031dGDqA==; 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 1f6vHd-0004Vh-12; Fri, 13 Apr 2018 09:46:17 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 776FE2029B0F8; Fri, 13 Apr 2018 11:46:15 +0200 (CEST) Date: Fri, 13 Apr 2018 11:46:15 +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: <20180413094615.GT4043@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]; > + int clamp_value; > + int group_id; > + > + /* Get task's specific clamp value */ > + clamp_value = p->uclamp[clamp_id].value; > + group_id = p->uclamp[clamp_id].group_id; > + > + /* No task specific clamp values: nothing to do */ > + if (group_id == UCLAMP_NONE) > + return; > + > + /* Increment the current group_id */ That I think qualifies being called a bad comment. > + uc_cpu->group[group_id].tasks += 1; > + > + /* Mark task as enqueued for this clamp index */ > + p->uclamp_group_id[clamp_id] = group_id; Why exactly do we need this? we got group_id from @p in the first place. I suspect this is because when we update p->uclamp[], we don't update this active value (when needed), is that worth it? > + /* > + * If this is the new max utilization clamp value, then we can update > + * straight away the CPU clamp value. Otherwise, the current CPU clamp > + * value is still valid and we are done. > + */ > + if (uc_cpu->value < clamp_value) > + uc_cpu->value = clamp_value; > +}