Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp681532imm; Fri, 14 Sep 2018 04:53:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbwhL9no53YiDeTuWzxzPDHaLDfAc/TdRHwCryD6jHR+iVymRdsXI9iOBfqq5c0jFfivgLY X-Received: by 2002:a63:a441:: with SMTP id c1-v6mr11707841pgp.182.1536925982462; Fri, 14 Sep 2018 04:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536925982; cv=none; d=google.com; s=arc-20160816; b=OmvAiCZGjELiATaayYIsAYsmoFgfRTXijrGrGdlYPSqqwwZQbfjSUvDRxRMuoCB8XN dAz0EQEHRSNXgXqq17ByPATC2ohjucZVqO3/9onO0KxEPMXQKfBVnRqoFUn5+Brkpema qsDdzeyskze5a7jyTmvZWXVRvsI6GbrTW6kI6vxNa5OIFZjXS32ODWaKa5FIVEAJISrw J8SwlpTDvf1WhiWN4P1QCXBZ3rigSQe/FSPYkSGn7HeoJxFyCfxnFbu+o+Sq8jtL6bK8 FeZEng6DhJK5904zZ4jPx8mM1X9LZGPmYIUrYOJgfKmx3a0j3kkaHwLDLXAEGJ64SA1A ulBQ== 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; bh=vHg8VORCODyeVP8U2W5S7fuglDv92go+PrmTD6yUjhI=; b=tT4OrolnpaH0JqnnxUVqYBGbiTZ1SD6vRDJavWn48RMfk+e9h9ATRKy1KZXb+J4O3Y M4h8FvKXPAMZa+AGRxAq3jgG3rbzfN82mJbtSCZpZTwWxtnQCw44W0imLwRoUAro20Va 30zaU+GhJmb8QiK4sPmzOz+1b2yYd2oMCbW3ZZJY+C4nNG/3x48jNlJcvRtcQw2LJ8mI 1TcJbpWUc5/xwaDjeQQ7338dSkFIasfbR7d6BgO2vuwNTHKhO3ssDKvpi5C+ffU9cOCZ pwYLXYTPUOMQA+QT5qQaXEpcB/MBXu7RPyk45ZKr9Y9kPYpERMp0Ik+Y+nRM4bHnEBl3 i/3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=W0pI8oTi; 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 64-v6si6444740plk.257.2018.09.14.04.52.46; Fri, 14 Sep 2018 04:53:02 -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=W0pI8oTi; 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 S1728020AbeINRGk (ORCPT + 99 others); Fri, 14 Sep 2018 13:06:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40196 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727754AbeINRGk (ORCPT ); Fri, 14 Sep 2018 13:06:40 -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=vHg8VORCODyeVP8U2W5S7fuglDv92go+PrmTD6yUjhI=; b=W0pI8oTikRoT3Ce7NSCEMAjVf enkuBfi+mwni1qImN5NNZgZabyiXZjyBoJcr20M7rU51kWR9AWrBDKcFWC1nVVjSRKeJ8tcFE4XHg q0EpaQDDb5a6GIsjMSotx//P/hWNfkg8iopHboLgrmzXAA2VzlYrqv0rr2rhrqVLob5SBcMED0xme AjsDZ2AGPvlVP5hJro+ksC0QOl8gj6urC0mcHCVZGIJhd1tawjHnRc6ip1MMvws5B8yB1/kRzQA8f agEvPSqzFcTVJIi8RKvpEBPYd+cWM6rlSBwmGbDAnmAz8Jp4drWHQBPYTxQE+KfaqhtFgvrHdFIlW RndVBD3rA==; 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 1g0me4-0002DW-3O; Fri, 14 Sep 2018 11:52:20 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7E00C202C1A09; Fri, 14 Sep 2018 13:52:17 +0200 (CEST) Date: Fri, 14 Sep 2018 13:52:17 +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 , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v4 03/16] sched/core: uclamp: add CPU's clamp groups accounting Message-ID: <20180914115217.GI24124@hirez.programming.kicks-ass.net> References: <20180828135324.21976-1-patrick.bellasi@arm.com> <20180828135324.21976-4-patrick.bellasi@arm.com> <20180913191209.GY24082@hirez.programming.kicks-ass.net> <20180914090751.GN1413@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180914090751.GN1413@e110439-lin> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 14, 2018 at 10:07:51AM +0100, Patrick Bellasi wrote: > On 13-Sep 21:12, Peter Zijlstra wrote: > > On Tue, Aug 28, 2018 at 02:53:11PM +0100, Patrick Bellasi wrote: > > > +static inline void uclamp_cpu_get_id(struct task_struct *p, > > > + struct rq *rq, int clamp_id) > > > +{ > > > + struct uclamp_group *uc_grp; > > > + struct uclamp_cpu *uc_cpu; > > > + int clamp_value; > > > + int group_id; > > > + > > > + /* Every task must reference a clamp group */ > > > + group_id = p->uclamp[clamp_id].group_id; > > > > > +} > > > + > > > +static inline void uclamp_cpu_put_id(struct task_struct *p, > > > + struct rq *rq, int clamp_id) > > > +{ > > > + struct uclamp_group *uc_grp; > > > + struct uclamp_cpu *uc_cpu; > > > + unsigned int clamp_value; > > > + int group_id; > > > + > > > + /* New tasks don't have a previous clamp group */ > > > + group_id = p->uclamp[clamp_id].group_id; > > > + if (group_id == UCLAMP_NOT_VALID) > > > + return; > > > > *confused*, so on enqueue they must have a group_id, but then on dequeue > > they might no longer have? > > Why not ? That's what it says on the tin, right? enqueue: "every task must reference clamp group" while on dequeue: "new tasks don't have a (previous) clamp group" and we check for NOT_VALID.