Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3204755imu; Wed, 7 Nov 2018 06:47:16 -0800 (PST) X-Google-Smtp-Source: AJdET5d+929XF8swG75dHD8OrJgM2ghU0iI3zkwoh7Xn1/wxvvfqUtFS3NreMCxta8I7IwHao4pD X-Received: by 2002:a17:902:654a:: with SMTP id d10-v6mr486646pln.302.1541602036364; Wed, 07 Nov 2018 06:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541602036; cv=none; d=google.com; s=arc-20160816; b=I7rpl8CF+XQmtqtradC0uL31+pDDqcYIftYn88S/zfHzRqIH6b8Qzir59KqqvadBvC r19LkXWBLPfQJhstx8r3v7aSwhmMjW82zFYfkkq8POQCy719k7IOaIcuzNsEYo8NIzB6 4zu0H2aHuakoPC0VEpDbWzsfdPmug7si09DPkp8DQCStDczkXE19U5PtazeAEzFsltvy W4pqbmFiyKC0B3jSeDj5fMAycWScnmCIwUBPf8Tgb4H6rLzGsWstEhDl85p1BINGHj9j GpF8RrnbcEgPLT/Bw/JKO67k6dVGeifuuL7htp/A2zASe9ZtHjgthtKWMnU8L+/Ezsv7 JHlw== 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=dm6APZ19b4h/dWPymPVe7CblDVoI5A3SjlphVBU11lM=; b=M4CU4ItPRiV2EkReC3x0lDdzhYr7RcNwgLo3hi6oJpvj/boXOBeko7xL+av8Vxu856 AllBbuoR1J1l1rjH56cMEa8L1oXkIrwC1QaJjCin6lHIQq1jpRzwo1kbdRbjFTQJb4hJ C3t00yM93/R7Vta4qqZPNM7RAdNI/P3F4GTMDCPgFiFhoxkLvoAYpdqG7oU2Z8ERqAnB po0uaUGXrFzO+VUusfb2ccaVyT6vNczXJnYUoNrT5237DrM5OKEXP251dpFpaHIm/bN7 75TeZvOrNVCkM+D6uNYYkUGv2DBmJz7gqS1rEMF9w3RWQ1lb5+YpjvwqyFTXWADsFqok W5CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BSqXYhbD; 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 n18-v6si783067plp.294.2018.11.07.06.47.00; Wed, 07 Nov 2018 06:47:16 -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=BSqXYhbD; 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 S1731003AbeKHAPd (ORCPT + 99 others); Wed, 7 Nov 2018 19:15:33 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:40904 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbeKHAPd (ORCPT ); Wed, 7 Nov 2018 19:15:33 -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=dm6APZ19b4h/dWPymPVe7CblDVoI5A3SjlphVBU11lM=; b=BSqXYhbD5iOCul3nZlvqnYQSG 76cLEPFY+1jGqG3M7lC1YtenN6TAwsj0sgxCQbfDvk3XHpW3bA//UD6MUBJZjkdBbVZ2w+nRdAFHi KOZANi3wVMZBWJ/xWEIjwOZsvM9bZcXMrD2/SGUFzoI9Io4WRaR+KCPFk2PA3fk3eezN2Yo6ukk+F Hnae+ztuA/464QcG+707cWbXQPMCQZkXY0uoA65hx2Rh/SqJMKVAOJjEZR67mQT4CsLrolWe5BZ2G SfOwvC0WBQL4jMcfvyfqDnkfEU/uUT7vbcVKb65Ios6PJdJcwk5imblhLeUsRLu7nEIBENmC4Kruc mdMvwb37Q==; 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 1gKP4c-0007OJ-FC; Wed, 07 Nov 2018 14:44:50 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6FE5F20284F94; Wed, 7 Nov 2018 15:44:48 +0100 (CET) Date: Wed, 7 Nov 2018 15:44:48 +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 03/15] sched/core: uclamp: map TASK's clamp values into CPU's clamp groups Message-ID: <20181107144448.GH9761@hirez.programming.kicks-ass.net> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-4-patrick.bellasi@arm.com> <20181107134414.GR9781@hirez.programming.kicks-ass.net> <20181107142428.GG14309@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181107142428.GG14309@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, Nov 07, 2018 at 02:24:28PM +0000, Patrick Bellasi wrote: > On 07-Nov 14:44, Peter Zijlstra wrote: > > On Mon, Oct 29, 2018 at 06:32:57PM +0000, Patrick Bellasi wrote: > > > +static void uclamp_group_get(struct uclamp_se *uc_se, unsigned int clamp_id, > > > + unsigned int clamp_value) > > > +{ > > > + union uclamp_map *uc_maps = &uclamp_maps[clamp_id][0]; > > > + unsigned int prev_group_id = uc_se->group_id; > > > + union uclamp_map uc_map_old, uc_map_new; > > > + unsigned int free_group_id; > > > + unsigned int group_id; > > > + unsigned long res; > > > + > > > +retry: > > > + > > > + free_group_id = UCLAMP_GROUPS; > > > + for (group_id = 0; group_id < UCLAMP_GROUPS; ++group_id) { > > > + uc_map_old.data = atomic_long_read(&uc_maps[group_id].adata); > > > + if (free_group_id == UCLAMP_GROUPS && !uc_map_old.se_count) > > > + free_group_id = group_id; > > > + if (uc_map_old.value == clamp_value) > > > + break; > > > + } > > > + if (group_id >= UCLAMP_GROUPS) { > > > +#ifdef CONFIG_SCHED_DEBUG > > > +#define UCLAMP_MAPERR "clamp value [%u] mapping to clamp group failed\n" > > > + if (unlikely(free_group_id == UCLAMP_GROUPS)) { > > > + pr_err_ratelimited(UCLAMP_MAPERR, clamp_value); > > > + return; > > > + } > > > +#endif > > > > Can you please put in a comment, either here or on top, on why this can > > not in fact happen? And we're always guaranteed a free group. > > You right, that's confusing especially because up to this point we are > not granted. We are always granted a free group once we add: > > sched/core: uclamp: add clamp group bucketing support > > I've kept it separated to better document how we introduce that > support. > > Is it ok for for you if I better call out in the change log that the > guarantee comes from a following patch... and add the comment in > that later patch ? Urgh.. that is mighty confusing and since this stuff actually 'works' might result in bisection issues too, right? I would really rather prefer a series that makes sense in the order you read it.