Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2120649imu; Thu, 24 Jan 2019 07:33:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN6HRcftr3CD/PWn9/E52Sgek7Ty1iBhwtgVhxJ96sI1oV4iugPb35o6NwsMFURQ2W6gtG+R X-Received: by 2002:a62:1e45:: with SMTP id e66mr6877219pfe.152.1548344016873; Thu, 24 Jan 2019 07:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548344016; cv=none; d=google.com; s=arc-20160816; b=oWi5ZoHMSdAGfzbuIAgM03Se+jMc66Ad0TIJi+2eIkPQPOjMbJ42oWDB8UnhSZ+I57 qke6y22bc9CYmFRS4yRa2YptwCheRpM0HceyXETvn91A2HHm2swsxndb13q9+2m/b312 7m5lKG5jdYLfy0a7KhdkRsMO3/R/0UY7HrIjyMphIcSQBHdpjYcpmX3BJS9zC+fzvpcJ z5QTSt3JjESPX1WOXGPzc+5YL8Z63bQ5AwpjTcJEqjmVdUJxWRqzztaZZ6HpFlW++T75 PT2tNx7EVqpl4uqCLQ1OhOaZ/Zv+NI1WpSoOH+CTjwz6M6kcxGsG5rEYJebYdRV4YKHG ZOig== 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=h8Wow38e1xWfn2ravzm+XKlFiamZ5hDUdxW/qYXbZzA=; b=T5i2IUfY6Ya22sK+KvA8/fB0F2Yi20Pof4F8BkPpIFMcbNF9tokV2dYVajnbdGHaOM pT9cT39pmYhUR4t1Jq9rZHsckeLupoY5yyoCW5H7xpS5Dhh6Wwuz2P3BHY7sCZ3YMouy 7nre4CRGOnHRi1vk5aoGYq9+XY7w0eEfHaVdwhEzrM6Gzgvv7j+ynwgXAQzttj41N7Iz PzfQpV5dCwzJ/3NvKOQVzEUbwo/BF6HoJiwZS/WfzgMG9cCOf+guV+YZWh9844kcwvO4 0rhWTR1woLOCL/Lg+W5m8M7ukakkv+20NhqdIDlTZMPwOS+Rg8TvuLfcc/ZjXYR3UyWD 17Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ehsh4xTg; 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 n3si23331910pld.36.2019.01.24.07.33.20; Thu, 24 Jan 2019 07:33:36 -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=bombadil.20170209 header.b=ehsh4xTg; 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 S1728630AbfAXPbM (ORCPT + 99 others); Thu, 24 Jan 2019 10:31:12 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44428 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbfAXPbM (ORCPT ); Thu, 24 Jan 2019 10:31:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=h8Wow38e1xWfn2ravzm+XKlFiamZ5hDUdxW/qYXbZzA=; b=ehsh4xTg9s2QQ6E3xW4Gq5f1t Mw2n/Y1on1l+kqzKNLErDRsWUwHrKxOOcN4LWwbYmrEKBmitlelKF6+jT6O2BB/qYefK6sR2m+ymu nwKcvX8K4xidlT0Y6iBtB05Hwvjwac4BI0pdtFuBsuTkqsxBlk85yTAx+lcqYWDxUtws4Pdt2vWaT HXI4Na0TjIhYEoh5LFkwv24vmtUSJqM2k9U98EANJo0LKVK47M/2uQEM3JsJIuobUIrU5ZdeQPLkv i3r+tTN1cPmV8ymc3ILp9tOd9Cb+DGkn3aP41EPLSmRdTrt8CGkzjrt1wCk2PEb0iDgj12YEy55lu wnEXER9zQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmgyC-0003pw-Aw; Thu, 24 Jan 2019 15:31:08 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8EA7420D1512D; Thu, 24 Jan 2019 16:31:06 +0100 (CET) Date: Thu, 24 Jan 2019 16:31:06 +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 09/16] sched/cpufreq: uclamp: Add utilization clamping for RT tasks Message-ID: <20190124153106.GQ13777@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-10-patrick.bellasi@arm.com> <20190123104944.GX27931@hirez.programming.kicks-ass.net> <20190123144011.iid3avb63r5v4r2c@e110439-lin> <20190123201146.GH17749@hirez.programming.kicks-ass.net> <20190124123009.2yulcf25ld66popd@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124123009.2yulcf25ld66popd@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 Thu, Jan 24, 2019 at 12:30:09PM +0000, Patrick Bellasi wrote: > > So I'll have to go over the code again, but I'm wondering why you're > > changing uclamp_se::bucket_id on a runnable task. > > We change only the "requested" value, not the "effective" one. > > > Ideally you keep bucket_id invariant between enqueue and dequeue; then > > dequeue knows where we put it. > > Right, that's what we do for the "effective" value. So the problem I have is that you first introduce uclamp_se::value and use that all over the code, and then introduce effective and change all the usage sites. That seems daft. Why not keep all the code as-is and add orig_value. > > Now I suppose actually determining bucket_id is 'expensive' (it > > certainly is with the whole mapping scheme, but even that integer > > division is not nice), so we'd like to precompute the bucket_id. > > Yes, although the complexity is mostly in the composition logic > described above not on mapping at all. We have "mapping" overheads > only when we change a "request" value and that's from slow-paths. It's weird though. Esp. when combined with that mapping logic, because then you get to use additional maps that are not in fact ever used. > > We can update uclamp_se::value and set uclamp_se::changed, and then the > > next enqueue will (unlikely) test-and-clear changed and recompute the > > bucket_id. > > This mean will lazy update the "requested" bucket_id by deferring its > computation at enqueue time. Which saves us a copy of the bucket_id, > i.e. we will have only the "effective" value updated at enqueue time. > > But... > > > Would that not be simpler? > > ... although being simpler it does not fully exploit the slow-path, > a syscall which is usually running from a different process context > (system management software). > > It also fits better for lazy updates but, in the cgroup case, where we > wanna enforce an update ASAP for RUNNABLE tasks, we will still have to > do the updates from the slow-path. > > Will look better into this simplification while working on v7, perhaps > the linear mapping can really help in that too. OK. So mostly my complaint is that it seems to do things odd for ill explained reasons.