Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3485202imu; Sun, 11 Nov 2018 16:10:00 -0800 (PST) X-Google-Smtp-Source: AJdET5chw6sClCsmH4i5zcNck47kteKpEZ4RClGvUSYxSQ1LaCWDsXM2GNy8jZ4scVvbTvIfO+jq X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr14128995plc.120.1541981400534; Sun, 11 Nov 2018 16:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981400; cv=none; d=google.com; s=arc-20160816; b=VxttJiW0L4Eb7I2nsfOFZCGEDaUhV/pFlgy4H/IThzKZjrEYUS5UVd6Jnl/Yy7Dv+Y XhABKTMiEeAr1mIaba5Qt3J18PFMwsC8Mw9pXVlGojaF6rz2gHu3X0iUbyrKilZo1mqB ZlHPYIXIgNyNNXqpRuHHuHjISXyXj6oy8/8H7Bl2jlxEUmQBcfRbQBTDrW1+QL6l7Nco i1QbB+/6dP/7H2MK79FN4YU57IXQeIIcoEu5ay5aLJ9sY6YriM9P76GFEksVA1mWjWV9 1rVYxMRRD7KRw1/eTjd6vVewiRB/xh6xwhEAeHf2D3a0FnXC15sDHjzREYzqqQFWEE8X SWDw== 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=MEPBEspqo1/sX1YIGNpJZ3Q8BKrPJh5IWW3uPkfAm/o=; b=KFCI2NIKDjEu1+1jIT/+cHHfoUUoELw87VlMpFrCTj7Bd0I7Ip7ImWrh3DcUYwtjzP Ms0Zh2kiRkgQkBJG0gYjz+EOoKV4FUxnu/R8lq7Ni/qJbnTBqLTlfXpeyBtTndnPNIip V1ARiBuzAwJEQ7Nob5PxtRQKcr1o9UzQIuekVKimIQejoIxEu6YJkP8xRfXsS4M2b68U pRdwSRNALcl2/+62m9L6L8J4ftRITBhzbZtGeFoouZDeA5Wqj545KpG9ZWd5kp1AEnUz k4/eD/g6dfOG/V4guJKXPA/VWsePbQFBzO0qnLoWpbsZRjZqId5prZNm9rolm6OXs7dV l1Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=0YbizrwB; 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 t64-v6si17154564pfd.58.2018.11.11.16.09.45; Sun, 11 Nov 2018 16:10: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=0YbizrwB; 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 S1731942AbeKLJ7u (ORCPT + 99 others); Mon, 12 Nov 2018 04:59:50 -0500 Received: from merlin.infradead.org ([205.233.59.134]:34996 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731045AbeKLJ7t (ORCPT ); Mon, 12 Nov 2018 04:59:49 -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=MEPBEspqo1/sX1YIGNpJZ3Q8BKrPJh5IWW3uPkfAm/o=; b=0YbizrwBxsnnuNpCjT7TVzgq1 oUG0ch2l+Pg3vAAn/FJ0HMB4WLAc0HCZ4EkF9WjoKcPoc4eakm5mCGlzuvAATzTEDAd3Dnl/z339c nSu+QLWB+LRn4KQJpMuLNOKXylnpc++FJmHd5QdqCWVuY5T1hO0Qka8irnEq1KcDeMrmbANDcNiT9 MWwd/Xs6eXuxcU8RFB9My94zm3i0CdsIdphrMZkw5a90sv9ldwTkuqWJ2j7IChZ7oUE0hQymCrh+8 +1fT3cTFg8A30zv4TMA34a9GzrAghIIQIktdshnhNs+ZEc9ieKuTABdt84cq9e3YVuxWVQiWQ5dhy 7LeK/lEJg==; Received: from [64.114.255.97] (helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLzmy-0004KQ-IS; Mon, 12 Nov 2018 00:09:12 +0000 Received: by worktop (Postfix, from userid 1000) id 4D9AA6E061A; Mon, 12 Nov 2018 01:09:10 +0100 (CET) Date: Mon, 12 Nov 2018 01:09:10 +0100 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@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 v5 07/15] sched/core: uclamp: add clamp group bucketing support Message-ID: <20181112000910.GC3038@worktop> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-9-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181029183311.29175-9-patrick.bellasi@arm.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 29, 2018 at 06:33:02PM +0000, Patrick Bellasi wrote: > The number of clamp groups configured at compile time defines the range > of utilization clamp values tracked by each CPU clamp group. > For example, with the default configuration: > CONFIG_UCLAMP_GROUPS_COUNT 5 > we will have 5 clamp groups tracking 20% utilization each. In this case, > a task with util_min=25% will have group_id=1. OK I suppose; but should we not do a wholesale s/group/bucket/ at this point? We should probably raise the minimum number of buckets from 1 though :-) > +/* > + * uclamp_group_value: get the "group value" for a given "clamp value" > + * @value: the utiliation "clamp value" to translate > + * > + * The number of clamp group, which is defined at compile time, allows to > + * track a finite number of different clamp values. Thus clamp values are > + * grouped into bins each one representing a different "group value". > + * This method returns the "group value" corresponding to the specified > + * "clamp value". > + */ > +static inline unsigned int uclamp_group_value(unsigned int clamp_value) > +{ > +#define UCLAMP_GROUP_DELTA (SCHED_CAPACITY_SCALE / CONFIG_UCLAMP_GROUPS_COUNT) > +#define UCLAMP_GROUP_UPPER (UCLAMP_GROUP_DELTA * CONFIG_UCLAMP_GROUPS_COUNT) > + > + if (clamp_value >= UCLAMP_GROUP_UPPER) > + return SCHED_CAPACITY_SCALE; > + > + return UCLAMP_GROUP_DELTA * (clamp_value / UCLAMP_GROUP_DELTA); > +} Can't we further simplify; I mean, at this point all we really need to know is the rq's highest group_id that is in use. We don't need to actually track the value anymore.