From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 1/7] sched/core: uclamp: add CPU clamp groups accounting Date: Fri, 13 Apr 2018 14:44:58 +0200 Message-ID: <20180413124458.GG4082@hirez.programming.kicks-ass.net> References: <20180409165615.2326-1-patrick.bellasi@arm.com> <20180409165615.2326-2-patrick.bellasi@arm.com> <20180413084302.GR4043@hirez.programming.kicks-ass.net> <20180413111510.GS14248@e110439-lin> <20180413113650.GR4064@hirez.programming.kicks-ass.net> <20180413114745.GV14248@e110439-lin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180413114745.GV14248@e110439-lin> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-pm@vger.kernel.org On Fri, Apr 13, 2018 at 12:47:45PM +0100, Patrick Bellasi wrote: > In the past I remember some funny dance in cgroup callbacks when a > task was terminating (like being moved in the root-rq just before > exiting). But, as you say, if we always have the task_rq_lock we > should be safe. The syscall does the whole: task_rq_lock(); queued = task_on_rq_queued(); running = task_current(); if (queued) dequeue_task(); if (running) put_prev_task(); /* * task is in invariant state here, * muck with it. */ if (queued) enqueue_task(); if (running) set_curr_task() task_rq_unlock(); pattern; which because C sucks, we've not found a good template for yet. Without the dequeue/put,enqueue/set you have to jump a few extra hoops.