Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1958019ybl; Thu, 9 Jan 2020 04:37:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzKgvdWdIYHwz8lL0TpCFrxz6J1QHTctTGZySdhCU5A5TLcqNgIHe0gC3onIwcS6ftj9EwY X-Received: by 2002:aca:ac88:: with SMTP id v130mr2743596oie.123.1578573456382; Thu, 09 Jan 2020 04:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578573456; cv=none; d=google.com; s=arc-20160816; b=bvxdRfcduDqeQ6iU3kwLkqvEjRyFcbC7HWEaOhMz1cFHmOVQiDIr438QJbKkI8AT48 34f63eMtJSbNNeb0DpHscBhh2y2gVxV9efJZGnyAUwxZagQcebOnyfiWcWi1QpIZeOAK LXVWzaxxeVPTW0P2Z+JpiDbQm+e7DkemZ/kfMtmb2/ffNyv7TobXSSZrQEf9BzyLydsc vri07gsBtF+l/YsevSmCBIDYJBfHSAmWlH12LZsOMwrLEIr34BTimzomPFdK8SdBibDL 7IZ87BEsxSnQFfl3Pnyz+3HE89THM5dolUzu8pwoOa72dOyCRjwqCBobjjSdqcROfh68 OTmQ== 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; bh=wk4irOe/OaLJubHg91pqN4uGnT+cxbZZamHbNREfkt0=; b=gIMDNOsPuqVmYNSF6THbFHYVu5SgT8ZIKtvcH7vOFrwx+l4/daHCUHdBQwfxwRep2T vWA5oheURFN7Zxn+KOD5YrgAn9lgMkSbD3auxSYkpOObYhvr9UVIbMRMxFygzW0BtiyR hTYltS6Op8m91Uk0jJxLrcaKyJNpVsywb5sJeiK8rn//o6gGB3jTN0nwnN2Q8s+Nun+r J+y1XHrss0h2AYChF0rOKFBcIhAo2zy7zsF9DGrQDW2gMs+C1tsQDFGxbU79p9SNhSqo 8LJ9WHKoN1GlLHPxpxraRX4+qy0S/CRmeMwYYgO1fKwjOMH1DGrFBrTnebRPsVoGfUSj 6zFg== 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 g16si3780132otj.79.2020.01.09.04.37.23; Thu, 09 Jan 2020 04:37:36 -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; 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 S1729956AbgAILQb (ORCPT + 99 others); Thu, 9 Jan 2020 06:16:31 -0500 Received: from foss.arm.com ([217.140.110.172]:57266 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728918AbgAILQa (ORCPT ); Thu, 9 Jan 2020 06:16:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C138031B; Thu, 9 Jan 2020 03:16:29 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A71DD3F703; Thu, 9 Jan 2020 03:16:27 -0800 (PST) Date: Thu, 9 Jan 2020 11:16:25 +0000 From: Qais Yousef To: Dietmar Eggemann Cc: Quentin Perret , Ingo Molnar , Peter Zijlstra , Steven Rostedt , Luis Chamberlain , Kees Cook , Iurii Zaikin , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , valentin.schneider@arm.com, Patrick Bellasi , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH] sched/rt: Add a new sysctl to control uclamp_util_min Message-ID: <20200109111624.5qxfidhvqa5vylcw@e107158-lin.cambridge.arm.com> References: <20191220164838.31619-1-qais.yousef@arm.com> <20200107134234.GA158998@google.com> <8bb17e84-d43f-615f-d04d-c36bb6ede5e0@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8bb17e84-d43f-615f-d04d-c36bb6ede5e0@arm.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/07/20 20:30, Dietmar Eggemann wrote: > On 07/01/2020 14:42, Quentin Perret wrote: > > Hi Qais, > > > > On Friday 20 Dec 2019 at 16:48:38 (+0000), Qais Yousef wrote: > > [...] > > >> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > >> index e591d40fd645..19572dfc175b 100644 > >> --- a/kernel/sched/rt.c > >> +++ b/kernel/sched/rt.c > >> @@ -2147,6 +2147,12 @@ static void pull_rt_task(struct rq *this_rq) > >> */ > >> static void task_woken_rt(struct rq *rq, struct task_struct *p) > >> { > >> + /* > >> + * When sysctl_sched_rt_uclamp_util_min value is changed by the user, > >> + * we apply any new value on the next wakeup, which is here. > >> + */ > >> + uclamp_rt_sync_default_util_min(p); > > > > The task has already been enqueued and sugov has been called by then I > > think, so this is a bit late. You could do that in uclamp_rq_inc() maybe? > > That's probably better. > Just to be sure ...we want this feature (an existing rt task gets its > UCLAMP_MIN value set when the sysctl changes) because there could be rt > tasks running before the sysctl is set? Yes. If the default value changes this sync will propagate it to all current RT task to reflect the new value. It is done in a lazy way though, so there will be a window where the RT task runs with the old value. > > >> + > >> if (!task_running(rq, p) && > >> !test_tsk_need_resched(rq->curr) && > >> p->nr_cpus_allowed > 1 && > >> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > >> index 280a3c735935..337bf17b1a9d 100644 > >> --- a/kernel/sched/sched.h > >> +++ b/kernel/sched/sched.h > >> @@ -2300,6 +2300,8 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {} > >> #endif /* CONFIG_CPU_FREQ */ > >> > >> #ifdef CONFIG_UCLAMP_TASK > >> +void uclamp_rt_sync_default_util_min(struct task_struct *p); > >> + > >> unsigned int uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id); > >> > >> static __always_inline > >> @@ -2330,6 +2332,8 @@ static inline unsigned int uclamp_util(struct rq *rq, unsigned int util) > >> return uclamp_util_with(rq, util, NULL); > >> } > >> #else /* CONFIG_UCLAMP_TASK */ > >> +void uclamp_rt_sync_default_util_min(struct task_struct *p) {} > > -void uclamp_rt_sync_default_util_min(struct task_struct *p) {} > +static inline void uclamp_rt_sync_default_util_min(struct task_struct > *p) {} +1 Thanks! -- Qais Yousef