Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6054870imu; Mon, 21 Jan 2019 02:20:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Sg9dwMsidiuiAugAtDdZjEYayCmVWCwAEjwu6J6VnSFG9vpoI2NaB+84ywwFXQbT0Pj7P X-Received: by 2002:a65:4683:: with SMTP id h3mr26421687pgr.225.1548066037879; Mon, 21 Jan 2019 02:20:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548066037; cv=none; d=google.com; s=arc-20160816; b=Z3grAFFmTb9KH/HN/MWAZ8A18vAAC+Vh7qYUVKLesva8wAy+T7gpHjakrX/TWIa1Qm bMcUSJ/be5VaUo4jio/GzlMceBhjIc8sm2pU7TXKANmHtGpRh6UjJcmkTyKY8XhYA1wg 6njj++7lhNKszuSlvU8jObuTg2qsUPicVAJGGLePGbBekFcift71Ic45W1rNL/m0O9Ow 9bpsW6j63VZj8e6I86ba3d9BU9uDEyrbl8yN7bqtFnh43h91qFNxqUglYqGG2ArWgnuB 0FJjHF2+T8AWjNk0X+qlXQhz27QvwEmhqaey8GYYjWByGFuKFHzjXGRxQDW0yZ+zJkBC TXEA== 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=uY/08fgxtflytJhqScXkleAgcZtw6KGXPG1PPyjViEM=; b=jlyiqxg8QuZzLzWNnozAhTuH3kYli6erfZOjAsjyL34qjoPaNfribNsw7H6rUIlxPI y7h2I8mhc8rPZx76EV0GtltSLNQLzsDJUZRsVkjeANEndnOhFVuXLb46XbItLp/WlBsS RxE+7NFW/CHP+PKe6bQCZ1oNLLJIs55Hh/f91pLKLkXseRgqGMO88p4LVRzPugeN8FTH 82zMj3Mk1ZOoqaLJOSDib6Navh1Mab1DQzRITUd37PjNBQNVEoNNnLWohZY4UepDTGc0 cYptQMnYVefv5Fq9Mse4zoQi7JO41eKN1Hm7ReQCiLaI3MLJg2sHYQQm3blQqnV67UaF OBIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=FdAIp6ut; 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 k125si11538922pfc.21.2019.01.21.02.20.22; Mon, 21 Jan 2019 02:20:37 -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=FdAIp6ut; 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 S1726750AbfAUKPP (ORCPT + 99 others); Mon, 21 Jan 2019 05:15:15 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:37988 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbfAUKPP (ORCPT ); Mon, 21 Jan 2019 05:15:15 -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=uY/08fgxtflytJhqScXkleAgcZtw6KGXPG1PPyjViEM=; b=FdAIp6utYyBbVagY5PUEMAQRR F/NPv3sY2g1RMByEtKDKDCWQF6UEGyU21qgik31O5X/PsUPNYXK+ux0Kmh89SexrSuHtVCVIewZfp nYOfoqCbW5s+RzYih8Gl1Pl/KYZAWIWgFm7M1n92ZyjEcSq6SV3MlbVREAglD9BUVbkpZ2+SEQnaI /73W6Yzydz/pYiIZv+uNdLV6BNSa47zJmXkuetMwkZewmbqAGlXRYRJy9wHobAdaHSTjzXJvc+S2x bq5ooHqJsRuJ5srlSEpA/3R3oTrzrjJDExgdo+QNfMGMX6Bwvte5JeQIY/8DfZ5Jx9ydwTjTdpctE brg8egXLw==; 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 1glWbn-0003tt-5I; Mon, 21 Jan 2019 10:15:11 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 83AB52846C9A6; Mon, 21 Jan 2019 11:15:08 +0100 (CET) Date: Mon, 21 Jan 2019 11:15:08 +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 03/16] sched/core: uclamp: Map TASK's clamp values into CPU's clamp buckets Message-ID: <20190121101508.GH27931@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-4-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115101513.2822-4-patrick.bellasi@arm.com> 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 Tue, Jan 15, 2019 at 10:15:00AM +0000, Patrick Bellasi wrote: > +/* > + * Number of utilization clamp buckets. > + * > + * The first clamp bucket (bucket_id=0) is used to track non clamped tasks, i.e. > + * util_{min,max} (0,SCHED_CAPACITY_SCALE). Thus we allocate one more bucket in > + * addition to the compile time configured number. > + */ > +#define UCLAMP_BUCKETS (CONFIG_UCLAMP_BUCKETS_COUNT + 1) > + > +/* > + * Utilization clamp bucket > + * @value: clamp value tracked by a clamp bucket > + * @bucket_id: the bucket index used by the fast-path > + * @mapped: the bucket index is valid > + * > + * A utilization clamp bucket maps a: > + * clamp value (value), i.e. > + * util_{min,max} value requested from userspace > + * to a: > + * clamp bucket index (bucket_id), i.e. > + * index of the per-cpu RUNNABLE tasks refcounting array > + * > + * The mapped bit is set whenever a task has been mapped on a clamp bucket for > + * the first time. When this bit is set, any: > + * uclamp_bucket_inc() - for a new clamp value > + * is matched by a: > + * uclamp_bucket_dec() - for the old clamp value > + */ > +struct uclamp_se { > + unsigned int value : bits_per(SCHED_CAPACITY_SCALE); > + unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); > + unsigned int mapped : 1; > +}; Do we want something like: BUILD_BUG_ON(sizeof(struct uclamp_se) == sizeof(unsigned int)); And/or put a limit on CONFIG_UCLAMP_BUCKETS_COUNT that guarantees that ?