Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7397372imu; Tue, 22 Jan 2019 05:30:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN4hmPTzVkPyuoX+MMIXcQZCuwoMD1nb7iDFPjVASmiT8tXz13Kd5SMXvZF9DCh4MJteyj4M X-Received: by 2002:a62:cd1:: with SMTP id 78mr33513967pfm.219.1548163800896; Tue, 22 Jan 2019 05:30:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548163800; cv=none; d=google.com; s=arc-20160816; b=f6nLZR1IQBGbqwDHvtBkipscO30SJFxnP9LEdYglN/eO6D/oUB8/97jwK/LBSdt1VP LMbdG1UMkG1jbiqzmQcNrk8S9rLbIsFcne6FMaWTwdKmO1iQcfrFEVPaCHZwQ6WwviOK Z5hGoirl/Bgxj7Pq5m4l34P44TSlRIE7T7mNRI/NjIpGTsDIhWNk05DBR5kkVS0BNSII OTKdM5A8BeLVW1kjDUqBgf8EoS1bvQMs44rtEmSSnH/ntyPFQVvcGttSNi8CJMBYKtom sAL7aeWFaz1LO4rDSWEOil5pPNw3/SwT31hkHMIa9sfqdtxyPLIC581Ub+Cf3+Ex4tRm 099g== 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=oaCtCQ6kT+by/muHzdDYBJDKqa8IRmfEauxvMMTSVZk=; b=SurUM3WKsiEvtPji4+2utB7zQglB/l+erLUTW3rlhTc/GEKKgkmHsRrOc70SbMHupH t3aI8t69v6u8RrYTQQruqY1U8b9HvWn4+Jky0A6YP80iqm2u3+XCOVSBKeoKXq1Zkm2u nvHcmYf4Pp9Y5juaUmpjDvkShqNL39cz9PWF1jv+ohgWvflb7UsO5vy4KvPMCgda2h+S fAExlhGPl6qx4qOnxiE+odBzkoPddH/SaaBq64dqDkM0YJGbyddTGC7CHu6PjSZKwbQG /cXdpsDRh2WmU3x6EF0hhv9OFRW9JyFa+ItkavvAsGircWll/+oi4gkcqkmmnU5XB4hl j1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=hRlytScT; 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 9si10322608pgm.112.2019.01.22.05.29.44; Tue, 22 Jan 2019 05:30:00 -0800 (PST) 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=hRlytScT; 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 S1728488AbfAVN2i (ORCPT + 99 others); Tue, 22 Jan 2019 08:28:38 -0500 Received: from merlin.infradead.org ([205.233.59.134]:60102 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbfAVN2h (ORCPT ); Tue, 22 Jan 2019 08:28:37 -0500 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=oaCtCQ6kT+by/muHzdDYBJDKqa8IRmfEauxvMMTSVZk=; b=hRlytScTE44qPk9wpY/NS5oJx d/uSvL+++Xynwf9V61OYBDeoG5zitCKJpc9imtTFLA1Rbdg/ckocKlJsUpMvVtFj95KsuifrTj6wL tah3begys5mED55FbfbIZOS6yWL3f6DP9UwKDr23NJa48SxU1NDDVQ9xPJapmDN0y6XJSZHxWg7qt pdwjnN7zol6zcYtw39P2tq262gxqv6JHYcvRB/Gj/jsc+ARJxnNLrE68Cjao08pyfRh+CfB5YL+92 i3K/qvdIaSKS5VR4JGhrF8jMpFkb50/3ApPKNRdh9gka9NRKlUjRDyu/kHcsJMiRFsD4ihFFWwpZm e2qKEZI8w==; 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 1glw6G-0001i0-37; Tue, 22 Jan 2019 13:28:20 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3B1F82042CFC3; Tue, 22 Jan 2019 14:28:17 +0100 (CET) Date: Tue, 22 Jan 2019 14:28:17 +0100 From: Peter Zijlstra To: Patrick Bellasi 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 v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes Message-ID: <20190122132817.GG13777@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-6-patrick.bellasi@arm.com> <20190121153308.GL27931@hirez.programming.kicks-ass.net> <20190121154412.fak2t2iquj3aixtu@e110439-lin> <20190122093704.GM27931@hirez.programming.kicks-ass.net> <20190122104305.6vjx37muqsxm536t@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190122104305.6vjx37muqsxm536t@e110439-lin> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 22, 2019 at 10:43:05AM +0000, Patrick Bellasi wrote: > On 22-Jan 10:37, Peter Zijlstra wrote: > > Sure, I get that. What I don't get is why you're adding that (2) here. > > Like said, __sched_setscheduler() already does a dequeue/enqueue under > > rq->lock, which should already take care of that. > > Oh, ok... got it what you mean now. > > With: > > [PATCH v6 01/16] sched/core: Allow sched_setattr() to use the current policy > <20190115101513.2822-2-patrick.bellasi@arm.com> > > we can call __sched_setscheduler() with: > > attr->sched_flags & SCHED_FLAG_KEEP_POLICY > > whenever we want just to change the clamp values of a task without > changing its class. Thus, we can end up returning from > __sched_setscheduler() without doing an actual dequeue/enqueue. I don't see that happening.. when KEEP_POLICY we set attr.sched_policy = SETPARAM_POLICY. That is then checked again in __setscheduler_param(), which is in the middle of that dequeue/enqueue. Also, and this might be 'broken', SETPARAM_POLICY _does_ reset all the other attributes, it only preserves policy, but it will (re)set nice level for example (see that same function). So maybe we want to introduce another (few?) FLAG_KEEP flag(s) that preserve the other bits; I'm thinking at least KEEP_PARAM and KEEP_UTIL or something.