From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v5 03/15] sched/core: uclamp: map TASK's clamp values into CPU's clamp groups Date: Wed, 7 Nov 2018 15:37:13 +0100 Message-ID: <20181107143713.GS9781@hirez.programming.kicks-ass.net> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-4-patrick.bellasi@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20181029183311.29175-4-patrick.bellasi@arm.com> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-pm@vger.kernel.org On Mon, Oct 29, 2018 at 06:32:57PM +0000, Patrick Bellasi wrote: > +static int __setscheduler_uclamp(struct task_struct *p, > + const struct sched_attr *attr) > +{ > + unsigned int lower_bound = p->uclamp[UCLAMP_MIN].value; > + unsigned int upper_bound = p->uclamp[UCLAMP_MAX].value; > + int result = 0; > + > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) > + lower_bound = attr->sched_util_min; > + > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) > + upper_bound = attr->sched_util_max; > + > + if (lower_bound > upper_bound || > + upper_bound > SCHED_CAPACITY_SCALE) > return -EINVAL; > > + mutex_lock(&uclamp_mutex); > > + /* Update each required clamp group */ > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) { > + uclamp_group_get(&p->uclamp[UCLAMP_MIN], > + UCLAMP_MIN, lower_bound); > + } > + if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) { > + uclamp_group_get(&p->uclamp[UCLAMP_MAX], > + UCLAMP_MAX, upper_bound); > + } > + > + mutex_unlock(&uclamp_mutex); > + > + return result; > +} I'm missing where we error due to lack of groups.