Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5816210imm; Mon, 23 Jul 2018 06:37:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfpBFCkj2eYBJIuHNvlIiXukv8qG3xjVT79F4uG42f3PUz9ymocN7Yl/9ILKRrmV5YScyCf X-Received: by 2002:a65:6211:: with SMTP id d17-v6mr12591798pgv.450.1532353069661; Mon, 23 Jul 2018 06:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532353069; cv=none; d=google.com; s=arc-20160816; b=JYXnEkQ5/DyOn9JqLwPFAVOewB/j0uSl4bdtokpby3x+uLG4T1ubCDJ7u2nCK57TfG 1eRgegvP+hB1hstKPn2Tu1AbbbOgu10Ii6UTmut9wnvTd1BtQw2Uygzzi/nDmFEep7n2 77dIukWiHVVOhNudDBgRu3nPB2o3Mq6EeQav+aiDTXCBKGn6iDWPp+TJTKACdmLD8UXE rDHGva9EGbpJF6o9vTwvlAzPnAsMFdBQkJwIZylkZI+N6qSa/EsUvlm4S09Gi/2VvR8T 2UCJGqFc/yk8DNvoVFMf2CwvDe4TRve8MWFl7MmcXAd7+/k/B7cUSRWy8MduOJYI9wFa upHw== 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:arc-authentication-results; bh=r5oCV0mpuDv0RaH3HcT73LI1OpKAe0Rp6aJLVGTGaxo=; b=eJkBmo9T9nzFY/6TcRJElcMCxKme5uJpu9xHSKg9c4yVUy/oYk8BY+xe0G3epEG3g+ 6bCITpJjQpnqeAUGFvRHrq6elqlKBMpc7wLshTGbEDiSDd8ZYtjuEiTRedl8y0jAMU/T UUozMAT4LAZK5XTsbG9zHFyVZ0sOk9/6hButAlrrgT1J9HxUtSAfkCFAhTo+FNkLqC25 BcFDpHKZaZ+dDoGVjut1DckxkKMc/Rc8OXrDtmSjq/Zpe0rZPBvjKmYF3O2gKO5RD7mw JEwunpr12Oe9u2vZF7wL7OmDRi/z/FK7fREazCMCPGkNQbFrifVQLlopn4xcN/oLiEwX styA== ARC-Authentication-Results: i=1; mx.google.com; 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 d38-v6si8824454pgl.88.2018.07.23.06.37.35; Mon, 23 Jul 2018 06:37:49 -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; 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 S2388241AbeGWOhi (ORCPT + 99 others); Mon, 23 Jul 2018 10:37:38 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34090 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387871AbeGWOhi (ORCPT ); Mon, 23 Jul 2018 10:37:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3657780D; Mon, 23 Jul 2018 06:36:20 -0700 (PDT) Received: from e110439-lin (e110439-lin.Emea.Arm.com [10.4.12.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8CBB23F237; Mon, 23 Jul 2018 06:36:17 -0700 (PDT) Date: Mon, 23 Jul 2018 14:36:15 +0100 From: Patrick Bellasi To: Suren Baghdasaryan Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v2 02/12] sched/core: uclamp: map TASK's clamp values into CPU's clamp groups Message-ID: <20180723133615.GB2683@e110439-lin> References: <20180716082906.6061-1-patrick.bellasi@arm.com> <20180716082906.6061-3-patrick.bellasi@arm.com> <20180720151156.GA31421@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-Jul 17:25, Suren Baghdasaryan wrote: [...] > > ---8<--- > > > > /* Uclamp flags */ > > #define SCHED_FLAG_UTIL_CLAMP_STRICT 0x11 /* Roll-back on failure */ > > #define SCHED_FLAG_UTIL_CLAMP_MIN 0x12 /* Update util_min */ > > #define SCHED_FLAG_UTIL_CLAMP_MAX 0x14 /* Update util_max */ > > #define SCHED_FLAG_UTIL_CLAMP ( \ > > SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX) > > > > Having ability to update only min or only max this way might be indeed > very useful. > Instead of rolling back on failure I would suggest to check both > inputs first to make sure there won't be any error before updating. > This would remove the need for SCHED_FLAG_UTIL_CLAMP_STRICT (which I > think any user would want to set to 1 anyway). > Looks like uclamp_group_get() can fail only if uclamp_group_find() > fails to find a slot for uclamp_value or a free slot. So one way to do > this search before update is to call uclamp_group_find() for both > UCLAMP_MIN and UCLAMP_MAX beforehand and if they succeed then pass > obtained next_group_ids into uclamp_group_get() to avoid doing the > same search twice. This requires some refactoring of > uclamp_group_get() but I think the end result would be a cleaner and > more predictable solution. Yes, that sound possible... provided we check all the groups under the same uclamp_mutex, it should be possible to find the group_ids before actually increasing the refcount. ... will look into this for the next reposting. -- #include Patrick Bellasi