From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Morten Rasmussen <morten.rasmussen@arm.com>
Subject: [PATCH 5/7] sched/fair: Remove cpu_avg_load_per_task()
Date: Fri, 29 Apr 2016 20:32:42 +0100 [thread overview]
Message-ID: <1461958364-675-6-git-send-email-dietmar.eggemann@arm.com> (raw)
In-Reply-To: <1461958364-675-1-git-send-email-dietmar.eggemann@arm.com>
From: Morten Rasmussen <morten.rasmussen@arm.com>
cpu_avg_load_per_task() is called in situations where the local
sched_group currently has no runnable tasks according to the group
statistics (sum of rq->cfs.h_nr_running) to calculate the local
load_per_task based on the destination cpu average load_per_task. Since
group has no tasks neither will env->dst_cpu as it is part of the local
sched_group. In this case the function will always return zero which is
also the value of the local load_per_task.
The only case where cpu_avg_load_per_task() might make a difference is
if another cpu places a task on env->dst_cpu after the group statistics
was gathered but before this bit of code is reached during an
idle_balance().
This race doesn't seem to be taken into account elsewhere, so the
function call doesn't seem to have any effect and should be safe to
remove.
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
kernel/sched/fair.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index dc4828bbe50d..e68b9eb5cb97 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4797,18 +4797,6 @@ static unsigned long capacity_orig_of(int cpu)
return cpu_rq(cpu)->cpu_capacity_orig;
}
-static unsigned long cpu_avg_load_per_task(int cpu)
-{
- struct rq *rq = cpu_rq(cpu);
- unsigned long nr_running = READ_ONCE(rq->cfs.h_nr_running);
- unsigned long load_avg = weighted_cpuload(cpu);
-
- if (nr_running)
- return load_avg / nr_running;
-
- return 0;
-}
-
static void record_wakee(struct task_struct *p)
{
/*
@@ -6922,9 +6910,8 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds)
local = &sds->local_stat;
busiest = &sds->busiest_stat;
- if (!local->sum_nr_running)
- local->load_per_task = cpu_avg_load_per_task(env->dst_cpu);
- else if (busiest->load_per_task > local->load_per_task)
+ if (local->sum_nr_running &&
+ busiest->load_per_task > local->load_per_task)
imbn = 0;
scaled_busy_load_per_task =
--
1.9.1
next prev parent reply other threads:[~2016-04-29 19:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 19:32 [PATCH 0/7] sched/fair: fixes and cleanups Dietmar Eggemann
2016-04-29 19:32 ` [PATCH 1/7] sched/fair: Remove remaining power aware scheduling comments Dietmar Eggemann
2016-05-05 9:42 ` [tip:sched/core] sched/fair: Remove stale " tip-bot for Dietmar Eggemann
2016-04-29 19:32 ` [PATCH 2/7] sched/fair: Fix comment in calculate_imbalance() Dietmar Eggemann
2016-05-05 9:42 ` [tip:sched/core] " tip-bot for Dietmar Eggemann
2016-04-29 19:32 ` [PATCH 3/7] sched/fair: Correct unit of load_above_capacity Dietmar Eggemann
2016-05-03 10:52 ` Peter Zijlstra
2016-05-03 14:56 ` Morten Rasmussen
2016-05-12 10:31 ` [tip:sched/core] " tip-bot for Morten Rasmussen
2016-05-12 21:48 ` Yuyang Du
2016-05-13 8:22 ` Vincent Guittot
2016-05-19 15:36 ` Morten Rasmussen
2016-05-20 8:17 ` Vincent Guittot
2016-05-23 20:24 ` Yuyang Du
2016-05-30 22:35 ` Yuyang Du
2016-04-29 19:32 ` [PATCH 4/7] sched/fair: Clean up the logic in fix_small_imbalance() Dietmar Eggemann
2016-05-03 10:12 ` Peter Zijlstra
2016-05-03 16:53 ` Dietmar Eggemann
2016-04-29 19:32 ` Dietmar Eggemann [this message]
2016-04-29 19:32 ` [PATCH 6/7] sched/fair: Reorder code in update_sd_lb_stats() Dietmar Eggemann
2016-04-29 19:32 ` [PATCH 7/7] sched/fair: Use group_cfs_rq(se) instead of se->my_q Dietmar Eggemann
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=1461958364-675-6-git-send-email-dietmar.eggemann@arm.com \
--to=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=morten.rasmussen@arm.com \
--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®