From: Yun Hsiang <hsiang023167@gmail.com>
To: dietmar.eggemann@arm.com, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, Yun Hsiang <hsiang023167@gmail.com>
Subject: [PATCH 1/1] sched/uclamp: release per-task uclamp control if user set to default value
Date: Mon, 28 Sep 2020 16:26:43 +0800 [thread overview]
Message-ID: <20200928082643.133257-1-hsiang023167@gmail.com> (raw)
If the user wants to release the util clamp and let cgroup to control it,
we need a method to reset.
So if the user set the task uclamp to the default value (0 for UCLAMP_MIN
and 1024 for UCLAMP_MAX), reset the user_defined flag to release control.
Signed-off-by: Yun Hsiang <hsiang023167@gmail.com>
---
kernel/sched/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9a2fbf98fd6f..fa63d70d783a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1187,6 +1187,7 @@ static void __setscheduler_uclamp(struct task_struct *p,
const struct sched_attr *attr)
{
enum uclamp_id clamp_id;
+ bool user_defined;
/*
* On scheduling class change, reset to default clamps for tasks
@@ -1210,14 +1211,16 @@ static void __setscheduler_uclamp(struct task_struct *p,
if (likely(!(attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)))
return;
+ user_defined = attr->sched_util_min == 0 ? false : true;
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) {
uclamp_se_set(&p->uclamp_req[UCLAMP_MIN],
- attr->sched_util_min, true);
+ attr->sched_util_min, user_defined);
}
+ user_defined = attr->sched_util_max == 1024 ? false : true;
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) {
uclamp_se_set(&p->uclamp_req[UCLAMP_MAX],
- attr->sched_util_max, true);
+ attr->sched_util_max, user_defined);
}
}
--
2.25.1
next reply other threads:[~2020-09-28 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 8:26 Yun Hsiang [this message]
2020-09-30 13:12 ` Dietmar Eggemann
2020-10-02 5:38 ` Yun Hsiang
2020-10-05 12:38 ` Dietmar Eggemann
2020-10-05 16:58 ` Patrick Bellasi
2020-10-05 17:15 ` Qais Yousef
2020-10-07 15:00 ` Yun Hsiang
2020-10-05 12:42 ` Pavan Kondeti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200928082643.133257-1-hsiang023167@gmail.com \
--to=hsiang023167@gmail.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®