Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp407218img; Mon, 18 Mar 2019 06:01:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbuwQ8pXqzRHC2v1rY6gjAUiEkkYKuw7vBC8Ma9/6chmDEeD1rqAN1Nh4TWK1WBqDSC98x X-Received: by 2002:a17:902:6b47:: with SMTP id g7mr20155601plt.100.1552914071390; Mon, 18 Mar 2019 06:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552914071; cv=none; d=google.com; s=arc-20160816; b=UQvMlR58RS9qu1Y/S2Wu2zX2jtMeXOAdQYFtwvE1qTF+kAjKnEFLNaZtPdnRqF46ZU sJCBZn/PvrJlJSdm9HwC7nYKIUdlHj3Exvmp1Q6xJQZ0tDVhnF0ZokJk/tmOM9b0oxf+ /p0Nc/RI9U2Pugidqp3nXVWZzbpcBvzr6quvCOohxtQqYv51a6cqJDSKqNoUW6LHRsmS N4PG/qYVeUhFG+LjkMTr9inrZh4g7djze0PN/0lUcIaNH1eFCStpPSM1eyJQmUw0H4CX oW98Fnr1o5RZz3Jrz1KM/bQz4U71lzOpi1mv9TyqaEfqraA0Pc7rilnawncb7ZD6RLtB nUsQ== 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; bh=/mCri7PS4tMUW013m7pgZmde/YKsvxSBMVzVa59e2uo=; b=M/2O4DpPUcc3sCPf2qjff3I8UwrTR/OYEbtYpuEMpxVDI/r9A3K82vjd2CSrZhRUiH rd3GRvJUwOsYkmXdCRhary2CKIyPHYJq3OvomMvhglFdyMmR3z7NxrYniN7qRvqUI/DR vf5h2UU+BHO9vFpk2sXko+TclwWR7ZIk/sdmNq4V1+ahPHy0izivkFxLHrZ02Pd6gm/l LydwnmZANnMUqSRhMvcULP+WVhKO/ZeziZnXFwHfXHY240fdHcTH1/Psw94S1JA6iCZx cifA9Ib9MSTxaw0w555QUs/hYchoYgfpZm8tWWypmsDwOzRRLqeAZSmcBjlGXQfemLZ+ oHbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t2si8794858pgp.444.2019.03.18.06.00.54; Mon, 18 Mar 2019 06:01: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; 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 S1727464AbfCRM6v (ORCPT + 99 others); Mon, 18 Mar 2019 08:58:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33846 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbfCRM6u (ORCPT ); Mon, 18 Mar 2019 08:58:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21047EBD; Mon, 18 Mar 2019 05:58:50 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B7EB3F71A; Mon, 18 Mar 2019 05:58:47 -0700 (PDT) Date: Mon, 18 Mar 2019 12:58:44 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v7 06/15] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK Message-ID: <20190318125844.ajhjpaqlcgxn7qkq@e110439-lin> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-7-patrick.bellasi@arm.com> <20190313205235.GX2482@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313205235.GX2482@worktop.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13-Mar 21:52, Peter Zijlstra wrote: > On Fri, Feb 08, 2019 at 10:05:45AM +0000, Patrick Bellasi wrote: > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 070caa1f72eb..8b282616e9c9 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -1071,7 +1071,7 @@ static void __setscheduler_uclamp(struct task_struct *p, > > } > > } > > > > -static void uclamp_fork(struct task_struct *p) > > +static void uclamp_fork(struct task_struct *p, bool reset) > > { > > unsigned int clamp_id; > > > > @@ -1080,6 +1080,17 @@ static void uclamp_fork(struct task_struct *p) > > IIRC there's an early return here if the class doesn't have uclamp > support, which I think is wrong now. You want the reset irrespective of > whether the class supports it, no? Yep, actually... since in this method we are always and only resetting certain values, it's probably better to just remove the check on class support and unconditionally do the required ones. > > for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) > > p->uclamp[clamp_id].active = false; > > + > > + if (likely(!reset)) > > + return; > > + > > + for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) { > > + unsigned int clamp_value = uclamp_none(clamp_id); > > + > > + p->uclamp[clamp_id].user_defined = false; > > + p->uclamp[clamp_id].value = clamp_value; > > + p->uclamp[clamp_id].bucket_id = uclamp_bucket_id(clamp_value); > > + } > > } > > -- #include Patrick Bellasi