Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3243192imc; Wed, 13 Mar 2019 12:32:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVm3P0FL3suCyu18Er+TadMeTexsC9/vy6Bzr/1sJFf+uCwiixl9iLKTbSdmop7ElVB8ZQ X-Received: by 2002:a17:902:421:: with SMTP id 30mr46338238ple.142.1552505538771; Wed, 13 Mar 2019 12:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505538; cv=none; d=google.com; s=arc-20160816; b=Y6UO5/fXinRU0aQURtK60vQVnaT0loEyJZH14NhXVTGskdfcCxk7IQL7xkyQWzzAqI ylsKfmu0nQvlHgYo8CVEjHgyo53hGi5siR4+NdHG4A1AWiDSVeQ3B1oYmTTiL3Vy+RqB VopjC66HgwKbcQcDBBotQkMIJn2hKPITNDjZWA05FIPYiOMV6UlSiTU9kNfUszveio9e Z+A2+JNKlRL7ZKLYgsDGC5ppHTxaOtWui0lCuS0HKR1arAoQFED6lPNXpyFHbZ4n6Oyn 5FXTySoV5p+9Pr9N85mAagVMND35Cbses3Da3hCK2b+jewnhlUb0L6F+znitwSRgJhW4 VIQQ== 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=eT5PPu8zGFQ87wtv0HuoZLW/3/b9KTRTD/vmD77hqHc=; b=Uju8qPLe53Qe0dKUil0ZFVy6VvQcyy++QQyDSGUga58M82OYyb9+uSMYkYiBbDebID qK1AnkquUeA8I5DzmulxPI+SYgnHpQjxfAKZbS4TMS4MN+iBuKlt6q1vvsZBjJQEtFmF fOOS/saSuc3VW9TRByYZ4SEvFFXdaOnpncccHmVtsyJbRP3H2tkCsLhOW5rq/BGj3qDa IlqZfOG2HsIZ6yUF15+Q8/vvY8HQRFg1JIIZB5TFuv8SDYd9e8wV4gCZOjUK2Whjed+K ZW3JcPAWESlyKio2ZoOTFcAsCqgWTvnGhtcCGDAazb2fC14DHaAB1ipPGfMmXyIcFG4y TPOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uesIYn0A; 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 a13si10807263pfo.279.2019.03.13.12.32.02; Wed, 13 Mar 2019 12:32:18 -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=bombadil.20170209 header.b=uesIYn0A; 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 S1727653AbfCMTbJ (ORCPT + 99 others); Wed, 13 Mar 2019 15:31:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33302 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727017AbfCMTbI (ORCPT ); Wed, 13 Mar 2019 15:31:08 -0400 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=eT5PPu8zGFQ87wtv0HuoZLW/3/b9KTRTD/vmD77hqHc=; b=uesIYn0AJYbI1o0Xkgi2upvC0 lN0PmaY8K4bKtrExQNwf6U00NkKS2Wx0bCWvL/XcsbaDTLb163slbHcbhna4KXC5hFcONKOnn4p3B P1NV0DaKUh4MX6YaTR1ZokKd6Yh/vhb7Sa7FWaThoxZkgy6zN9FwWUuiiOSxdMBdomQvq+t869cgz /ptvxcaTrFihZHXLPC/bGRYO3rRDLhHQwJIIkBiMUe1z9Rr/QmMg+kYjzlCV88PfyQzYdqTEYOI5g d0hoNdHlXaCbbDkXHsaUL4zvtnJxsEz4rYWyqjfO2U1jaRlQwlNnAs2CrA6XGEesRQ1IUIKvgjxPc rv+/NCH4w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h49ae-0004wP-Gt; Wed, 13 Mar 2019 19:31:00 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id B18879826C0; Wed, 13 Mar 2019 20:30:56 +0100 (CET) Date: Wed, 13 Mar 2019 20:30:56 +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 v7 01/15] sched/core: uclamp: Add CPU's clamp buckets refcounting Message-ID: <20190313193056.GP2482@worktop.programming.kicks-ass.net> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-2-patrick.bellasi@arm.com> <20190313135238.GC5922@hirez.programming.kicks-ass.net> <20190313155954.jse2tyn5iqxm6wle@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313155954.jse2tyn5iqxm6wle@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 Wed, Mar 13, 2019 at 03:59:54PM +0000, Patrick Bellasi wrote: > On 13-Mar 14:52, Peter Zijlstra wrote: > > > +static inline void uclamp_rq_dec_id(struct task_struct *p, struct rq *rq, > > > + unsigned int clamp_id) > > > +{ > > > + unsigned int bucket_id = p->uclamp[clamp_id].bucket_id; > > > + unsigned int rq_clamp, bkt_clamp; > > > + > > > + SCHED_WARN_ON(!rq->uclamp[clamp_id].bucket[bucket_id].tasks); > > > + if (likely(rq->uclamp[clamp_id].bucket[bucket_id].tasks)) > > > + rq->uclamp[clamp_id].bucket[bucket_id].tasks--; > > > + > > > + /* > > > + * Keep "local clamping" simple and accept to (possibly) overboost > > > + * still RUNNABLE tasks in the same bucket. > > > + */ > > > + if (likely(rq->uclamp[clamp_id].bucket[bucket_id].tasks)) > > > + return; > > > > (Oh man, I hope that generates semi sane code; long live CSE passes I > > suppose) > > What do you mean ? that does: 'rq->uclamp[clamp_id].bucket[bucket_id].tasks' three times in a row. And yes the compiler _should_ dtrt, but....