Received: by 10.192.165.156 with SMTP id m28csp660474imm; Fri, 13 Apr 2018 05:51:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ePgaCoUHT1VTA10eFUqPlTL8xBdnQfzrFHWV/rypzzIlP88DY76nGE1kMMEamnIqpNlGn X-Received: by 10.98.201.15 with SMTP id k15mr11458462pfg.184.1523623866634; Fri, 13 Apr 2018 05:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523623866; cv=none; d=google.com; s=arc-20160816; b=w10MyG0KVu+gDshf0ZQPqOnrxaUj/qsr8fMOJBiMQBeQSVz1vAiEDHjChzOI6W5ZtF ueBZtMidkxHcNvu6z+XpiHodWDngita2dXaJ5nOVpFIZ/g7rYTkZqIEL7rDnG9f4W7Nr 35ZqvMKk6QWjD5IT4NuyQBnScz/8o2wBVM0Xpw7/DFahO1gAH+eTYxifggzo9XeqiyBP +Y/9rTld90P4NeiC6viSbS7qvQWaPmBGs6ov1d6xKns+VCulsfxaUyUnFT0YttprN2m8 lk8oqMFZMYRb55hk11aMAmkLEGHPKxtkl5apZ/fB4u7NPmbvlEZKQCcaiP5TvmBZgUhF PZxw== 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=U+nUp1+XR5XKyW/TO9UHB/0zr79SFY8tQ19kIWGKSs4=; b=PAO5fk/HwwCN8OIBg75Qo0XUDhmIVzBtBtmIZ4fnqwiFEkp6ZBLhWKTHT09ACNzUUG Pma+rw9oJIF8LxMmErtKZBCNQyQ97rQ5m6jjGdenBXUGPmTK5IereOJAZ2yjjbgwWE54 GrcBQVbeNyGm80fgXtXyn6yEwKAeOceM1A2xD2F9XREOagIATpx9On8QhwVWo7jEfBwu 2tebL5atOlE6K0lTzUNkmy6hIe87Q0xlmkzvvRrCdvZwZc6aBdicb8AO6Lga/3f5LJTA Z71pqz//ggimfdReOCcJ0CxbgjybN/VOYVmn8RcAHeN/te3e9i4FgdVbcqMAhdyzZSt5 tqdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=oeL1eDQQ; 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 b10-v6si5215241plz.464.2018.04.13.05.50.52; Fri, 13 Apr 2018 05:51:06 -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=oeL1eDQQ; 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 S1754440AbeDMMpO (ORCPT + 99 others); Fri, 13 Apr 2018 08:45:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:37016 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbeDMMpM (ORCPT ); Fri, 13 Apr 2018 08:45:12 -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=U+nUp1+XR5XKyW/TO9UHB/0zr79SFY8tQ19kIWGKSs4=; b=oeL1eDQQGQu1SzClayc+xJcce eVvTt967bSQFadqBEApJSNbiGtj3oihSWFadK+OTBnfjdqqM94naUaW1A93AQKoewcfUBLvOGuc9m cJOcCECdakicvYY4Rhj6ATFT27bRKgdz1OJqO+1T1cHUg8BAd7kJNr47hGebvwGhqrYbu2vGqw4CR eQLwCP6axHXeBTaRiTM0dX09yLJOkkMlQVtr6LXjsP5VcTdIfJYBqSevXgRRQB4jJ0dk2IBN4tFOy wdhv/gyekGaKScuQOODSA8F/mJ+Ep3rCvm+6UFOAj0AdkaBC5i/MTdL1HW/y1J9PBhGM/sMmBObsA LKHcWcXVQ==; 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 1f6y4b-0004dT-46; Fri, 13 Apr 2018 12:45:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 42B742029B0F9; Fri, 13 Apr 2018 14:44:58 +0200 (CEST) Date: Fri, 13 Apr 2018 14:44:58 +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: <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 Content-Disposition: inline In-Reply-To: <20180413114745.GV14248@e110439-lin> 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 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.