From: tip-bot for Patrick Bellasi <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dietmar.eggemann@arm.com, tkjos@google.com,
juri.lelli@redhat.com, morten.rasmussen@arm.com,
tglx@linutronix.de, patrick.bellasi@arm.com, mingo@kernel.org,
surenb@google.com, smuckle@google.com,
vincent.guittot@linaro.org, quentin.perret@arm.com,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
peterz@infradead.org, hpa@zytor.com
Subject: [tip:sched/core] sched/fair: Mask UTIL_AVG_UNCHANGED usages
Date: Sun, 11 Nov 2018 22:03:20 -0800 [thread overview]
Message-ID: <tip-92a801e5d5b7a893881c1676b15dd246727ccd16@git.kernel.org> (raw)
In-Reply-To: <20181105145400.935-3-patrick.bellasi@arm.com>
Commit-ID: 92a801e5d5b7a893881c1676b15dd246727ccd16
Gitweb: https://git.kernel.org/tip/92a801e5d5b7a893881c1676b15dd246727ccd16
Author: Patrick Bellasi <patrick.bellasi@arm.com>
AuthorDate: Mon, 5 Nov 2018 14:53:59 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 12 Nov 2018 06:17:52 +0100
sched/fair: Mask UTIL_AVG_UNCHANGED usages
The _task_util_est() is mainly used to add/remove the task contribution
to/from the rq's estimated utilization at task enqueue/dequeue time.
In both cases we ensure the UTIL_AVG_UNCHANGED flag is set to keep
consistency between enqueue and dequeue time while still being
transparent to update_load_avg calls which will eventually reset the
flag.
Let's move the flag forcing within _task_util_est() itself so that we
can simplify calling code by hiding that estimated utilization
implementation detail into one of its internal functions.
This will affect also the "public" API task_util_est() but we know that
the flag will (eventually) impact just on the LSB of the estimated
utilization, thus it's certainly acceptable.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Perret <quentin.perret@arm.com>
Cc: Steve Muckle <smuckle@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Todd Kjos <tkjos@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Link: http://lkml.kernel.org/r/20181105145400.935-3-patrick.bellasi@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/fair.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a1ccf1ddd37a..28ee60cabba1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3604,7 +3604,7 @@ static inline unsigned long _task_util_est(struct task_struct *p)
{
struct util_est ue = READ_ONCE(p->se.avg.util_est);
- return max(ue.ewma, ue.enqueued);
+ return (max(ue.ewma, ue.enqueued) | UTIL_AVG_UNCHANGED);
}
static inline unsigned long task_util_est(struct task_struct *p)
@@ -3622,7 +3622,7 @@ static inline void util_est_enqueue(struct cfs_rq *cfs_rq,
/* Update root cfs_rq's estimated utilization */
enqueued = cfs_rq->avg.util_est.enqueued;
- enqueued += (_task_util_est(p) | UTIL_AVG_UNCHANGED);
+ enqueued += _task_util_est(p);
WRITE_ONCE(cfs_rq->avg.util_est.enqueued, enqueued);
}
@@ -3650,8 +3650,7 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep)
/* Update root cfs_rq's estimated utilization */
ue.enqueued = cfs_rq->avg.util_est.enqueued;
- ue.enqueued -= min_t(unsigned int, ue.enqueued,
- (_task_util_est(p) | UTIL_AVG_UNCHANGED));
+ ue.enqueued -= min_t(unsigned int, ue.enqueued, _task_util_est(p));
WRITE_ONCE(cfs_rq->avg.util_est.enqueued, ue.enqueued);
/*
@@ -6292,7 +6291,7 @@ static unsigned long cpu_util_without(int cpu, struct task_struct *p)
*/
if (unlikely(task_on_rq_queued(p) || current == p)) {
estimated -= min_t(unsigned int, estimated,
- (_task_util_est(p) | UTIL_AVG_UNCHANGED));
+ _task_util_est(p));
}
util = max(util, estimated);
}
next prev parent reply other threads:[~2018-11-12 6:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-05 14:53 [PATCH v2 0/3] util_est regression fixup and cleanups Patrick Bellasi
2018-11-05 14:53 ` [PATCH v2 1/3] sched/fair: util_est: fix cpu_util_wake for execl Patrick Bellasi
2018-11-05 14:53 ` [PATCH v2 2/3] sched/fair: util_est: mask UTIL_AVG_UNCHANGED usages Patrick Bellasi
2018-11-12 6:03 ` tip-bot for Patrick Bellasi [this message]
2018-11-05 14:54 ` [PATCH v2 3/3] sched/fair: add lsub_positive and use it consistently Patrick Bellasi
2018-11-12 4:16 ` Ingo Molnar
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=tip-92a801e5d5b7a893881c1676b15dd246727ccd16@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dietmar.eggemann@arm.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=morten.rasmussen@arm.com \
--cc=patrick.bellasi@arm.com \
--cc=peterz@infradead.org \
--cc=quentin.perret@arm.com \
--cc=smuckle@google.com \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--cc=tkjos@google.com \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@linaro.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