Received: by 10.192.165.156 with SMTP id m28csp445519imm; Fri, 13 Apr 2018 01:51:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/tQFPokxgT33nwdipfyvDp8xvgiuK5b0WIqRgsb/e89uQsdPw0NATDfhWfM/MQhbaLJ82h X-Received: by 10.98.46.5 with SMTP id u5mr2849396pfu.247.1523609471535; Fri, 13 Apr 2018 01:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523609471; cv=none; d=google.com; s=arc-20160816; b=rjg4wTrC+3QMQkEEmp43Ry05NH+vdB5mB4mKUk2tz1p3Y7m18cxNCb4bnXj3jNNA+D WGwGBOgxQm1DHeoFfiZA5b5Ts5ffqHJal78PD+HFwYQhgfhxKjzCdjy7G0vyj5v/BZ8x WAFEpPUqQExoS5AukknzzkEXG6HcDfFhYleI/jeHg16cPIYBp9ptOy61RqlKKrLcy48B CnvWohvZuP+NnMwnhQVrA179GtQo5UndDiWC0TkmfKb6StOyqHVvHQSl40wtd3iopt7K d5eVWUmY0FR/sRP33BsTbqDtfaqB+0nKO0ah/lt5VfmNdtoFYwLlQX95pSu1EYL0p1XC nj6Q== 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=z5Kjj6pPpdpktN3E4iNq01PSUqm8KDDd/skFOQ1PBzU=; b=eE7vGo9lbwWZWFjt5PG726D0YCSrrZzzSypy07d0LCKUutOitn0eTrU3sv81xyS+y6 s+7v99V0Q/Zc9uIUlL+//2Gf1yzJ4c2Zk80j1aI4zReKzr/NDuOTghAhJJgKxa19xGQn 8nm+TZYQbpXNJvBr0jjGQKY7wHykr4iTFum8XmXH67j8fwKmhy4q/LzkZ3U0YKtZSgJD fM7eGM2DpbJ4s3ze1K1ZzzL8KgPHNCkSVLca6bF8Uq8ctFuLJHzdpe1q45qEZu0/P4Mh xEnKSDYGwT8/Vfu3uBrJMeiJWsQzPAagxt/DrzPRMEG0jPRala3Zpp6eXlZdb7X7+NIR AVvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=lnc6TqMD; 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 r2-v6si5225155pli.669.2018.04.13.01.50.57; Fri, 13 Apr 2018 01:51:11 -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=lnc6TqMD; 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 S1753953AbeDMInN (ORCPT + 99 others); Fri, 13 Apr 2018 04:43:13 -0400 Received: from merlin.infradead.org ([205.233.59.134]:35890 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbeDMInL (ORCPT ); Fri, 13 Apr 2018 04:43:11 -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=z5Kjj6pPpdpktN3E4iNq01PSUqm8KDDd/skFOQ1PBzU=; b=lnc6TqMDo2SRKYql4SwJd7MbV vxhv79Khs+9VfsEaIIV8yxwv+4btg+jsz7pSNOrBYH9/Saylvs+Bz3EMMs/DL85BYWJJ1qBxUt+DP ihgaTeLr+FzDTYGTk5J/JtKbqJQIBSo8k9Vk8KD8IoRQrvq42W4rDliThafVLL2JAPHnfO/Pr56Wt xYIiLIMUXzCnMx0Emfh5ymBwiW89wRt8oNN01CTFrGqBA9tgCqb4k0V/J1eglTLqAM+69ektFlKft MYjoH+pFiKQogAUkrLAHKLQ/IWA2UxoqPIq9jFsVvi/byCIEXmdzmsSeZWWQBR9c5BBR/qmflw1jG zfLc5v5Cg==; 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 1f6uIS-0003kx-0T; Fri, 13 Apr 2018 08:43:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ACF582029F86F; Fri, 13 Apr 2018 10:43:02 +0200 (CEST) Date: Fri, 13 Apr 2018 10:43: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: <20180413084302.GR4043@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_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; > + > + 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); > + } > +} Is that uclamp_task_affects() thing there to fix up the fact you failed to propagate the calling context (enqueue/dequeue) ? I find this code _really_ hard to read... > @@ -743,6 +929,7 @@ static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags) > if (!(flags & ENQUEUE_RESTORE)) > sched_info_queued(rq, p); > > + uclamp_task_update(rq, p); > p->sched_class->enqueue_task(rq, p, flags); > } > > @@ -754,6 +941,7 @@ static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags) > if (!(flags & DEQUEUE_SAVE)) > sched_info_dequeued(rq, p); > > + uclamp_task_update(rq, p); > p->sched_class->dequeue_task(rq, p, flags); > } >