Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7191229imu; Tue, 22 Jan 2019 01:48:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN5UGeZUc3jOQyPyw97+LIvu/ORArBhp1VkukPxPDPteK501olCXjTW4uFs/4eQ57tcTTjVt X-Received: by 2002:a63:fc49:: with SMTP id r9mr30703101pgk.209.1548150483023; Tue, 22 Jan 2019 01:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548150483; cv=none; d=google.com; s=arc-20160816; b=kdrlSjBEyKkHN4tXp5yrPqx3GGnbYz6dA/WcZnFsvymqJ8Shf0QMQx/3+/U/GptjeE K8whWZv4giz65uJMUUMHIfzpklDwaYjIhMqTtwUR5CZ7rylL1/pOqjzxSmiVIt4HU8IZ wxIgf0Nnk8IG/F3pKttBUC4WTkEImRBIj6BVgTvbZHNejbSSAfX8Xsz9YgUq6p/DUtbv wIj9PT8S+EKuj2+JKleUkiBL4zNquos1fuiRPfTpl8EQijZXednzh8iNc+/exb1B6iUU O7EefLIceinNgmjbZ1MkR57tMCEFqjjlJ8nLUZZC5cqXi7cP7qVPQCvleQVuiaySnP+d gVVA== 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=sZa+wKfGdynh6C+yxUM26dT34VAjzflHBGafSA9mNMU=; b=dFXyZ6aFsaOOP1soMTVkzx8A22v+2GdLL7J4K+nBcicDvpaVX0NQsIJk+qTnMOMCGY v8NT6sADnpL0HsKa9effxDfXDDY8BKkQ2Jk9xmlxvqg+rVgd1HesIEGVvX4/S/B/g5B8 U5Jwu2APg+NLsOFs6Po6U049hu1S98DcobTOt3VefE8lB+UqruM9Xg0/Z100uK/GrLqk SGh669pbKvBXk2AFmaoZBTOKqEFPZIybaLZp+jRWxv48yBaUA54R87ptgBaJcH0hc4nM SXNr1C3GkMYNOPp/on3Z8DE7dfbKryutUCOwaAScMimAUCesMaV0oXhR4TnYxoNpovEy j28Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=B5YqQXIG; 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 24si9617820pgm.167.2019.01.22.01.47.47; Tue, 22 Jan 2019 01:48:02 -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=B5YqQXIG; 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 S1728079AbfAVJpO (ORCPT + 99 others); Tue, 22 Jan 2019 04:45:14 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:53344 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727274AbfAVJpN (ORCPT ); Tue, 22 Jan 2019 04:45:13 -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=sZa+wKfGdynh6C+yxUM26dT34VAjzflHBGafSA9mNMU=; b=B5YqQXIG576tSTDwoUMJmgz5G FyVJeHm2zNsIM5xj3A1pn+HfU/gqLaMS/+qPsm62Vqg3zf+mjK21mgRhz/b60FqcFiEc0u5V4gopX lWNFtjtFrq/y8tNieeBl9rzG9637Ge5bzWARbQ4LjOOFn72K32jgUVvCRWabjFsU+rvbhBRDgd29g n2A0I/IJWoGm1HtsVTEpTuXyzcJvVkkOXjNl7d25Y8+j5g2ug/2WI7lEZvi4ypRCf86bwD6Qj770I v3VarhTZ9FWARJXmSeqPN0lMNomG9oFzZX/9IDScdEW9Xcsma/4FP+BQzcoJ++76cisUOJ3PKZWwP YRJvMYsVA==; 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 1glscH-0005pG-8W; Tue, 22 Jan 2019 09:45:09 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BB2EC211A59B4; Tue, 22 Jan 2019 10:45:07 +0100 (CET) Date: Tue, 22 Jan 2019 10:45:07 +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 04/16] sched/core: uclamp: Add CPU's clamp buckets refcounting Message-ID: <20190122094507.GN27931@hirez.programming.kicks-ass.net> References: <20190115101513.2822-1-patrick.bellasi@arm.com> <20190115101513.2822-5-patrick.bellasi@arm.com> <20190121145929.GI27931@hirez.programming.kicks-ass.net> <20190121152311.7u7bwbjopuptnzcy@e110439-lin> <20190121161237.GB13777@hirez.programming.kicks-ass.net> <20190121163337.6l7hkggicndtpzjs@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190121163337.6l7hkggicndtpzjs@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 Mon, Jan 21, 2019 at 04:33:38PM +0000, Patrick Bellasi wrote: > On 21-Jan 17:12, Peter Zijlstra wrote: > > On Mon, Jan 21, 2019 at 03:23:11PM +0000, Patrick Bellasi wrote: > > > and keep all > > > the buckets in use at the beginning of a cache line. > > > > That; is that the rationale for all this? Note that per the defaults > > everything is in a single line already. > > Yes, that's because of the loop in: > > dequeue_task() > uclamp_cpu_dec() > uclamp_cpu_dec_id() > uclamp_cpu_update() > > where buckets needs sometimes to be scanned to find a new max. > > Consider also that, with mapping, we can more easily increase the > buckets count to 20 in order to have a finer clamping granularity if > needed without warring too much about performance impact especially > when we use anyway few different clamp values. > > So, I agree that mapping adds (code) complexity but it can also save > few cycles in the fast path... do you think it's not worth the added > complexity? Then maybe split this out in a separate patch? Do the trivial linear bucket thing first and then do this smarty pants thing on top. One problem with the scheme is that it doesn't defrag; so if you get a peak usage, you can still end up with only two active buckets in different lines. Also; if it is it's own patch, you get a much better view of the additional complexity and a chance to justify it ;-) Also; would it make sense to do s/cpu/rq/ on much of this? All this uclamp_cpu_*() stuff really is per rq and takes rq arguments, so why does it have cpu in the name... no strong feelings, just noticed it and thought is a tad inconsistent.