From: Peter Williams <pwil3058@bigpond.net.au>
To: Andrew Morton <akpm@osdl.org>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>,
Con Kolivas <kernel@kolivas.org>, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Mike Galbraith <efault@gmx.de>,
Nick Piggin <nickpiggin@yahoo.com.au>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>
Subject: [PATCH] sched: fix evaluation of skip_for_load in move_tasks()
Date: Tue, 25 Apr 2006 13:08:00 +1000 [thread overview]
Message-ID: <444D9290.6070706@bigpond.net.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
Problem:
In the patch
sched-avoid-unnecessarily-moving-highest-priority-task-move_tasks.patch
I got a the sense of a boolean expression wrong when assigning a value
to skip_for_load. The expression should have been negated before being
assigned.
Additionally, busiest_best_prio_seen is being set when tasks are moved
instead of when they are skipped which will cause problems when the
current task does not have prio=busiest_best_prio.
Solution:
Negate the expression and apply de Marcos rule to simplify it and move
the setting of busiest_best_prio_seen.
This patch is on top of
sched-avoid-unnecessarily-moving-highest-priority-task-move_tasks.patch
Signed-off-by: Peter Williams <pwil3058@bigpond.com.au>
--
Peter Williams pwil3058@bigpond.net.au
"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
[-- Attachment #2: smpnice-fix-busiest_best_prio_seen --]
[-- Type: text/plain, Size: 1526 bytes --]
Index: MM-2.6.17-rc1-mm3/kernel/sched.c
===================================================================
--- MM-2.6.17-rc1-mm3.orig/kernel/sched.c 2006-04-25 12:53:39.000000000 +1000
+++ MM-2.6.17-rc1-mm3/kernel/sched.c 2006-04-25 12:56:14.000000000 +1000
@@ -2059,7 +2059,10 @@ static int move_tasks(runqueue_t *this_r
busiest_best_prio = rq_best_prio(busiest);
/*
* Enable handling of the case where there is more than one task
- * with the best priority.
+ * with the best priority. If the current running task is one
+ * of those with prio==busiest_best_prio we know it won't be moved
+ * and therefore it's safe to override the skip (based on load) of
+ * any task we find with that prio.
*/
busiest_best_prio_seen = busiest_best_prio == busiest->curr->prio;
@@ -2108,9 +2111,10 @@ skip_queue:
*/
skip_for_load = tmp->load_weight > rem_load_move;
if (skip_for_load && idx < this_best_prio)
- skip_for_load = busiest_best_prio_seen || idx != busiest_best_prio;
+ skip_for_load = !busiest_best_prio_seen && idx == busiest_best_prio;
if (skip_for_load ||
!can_migrate_task(tmp, busiest, this_cpu, sd, idle, &pinned)) {
+ busiest_best_prio_seen |= idx == busiest_best_prio;
if (curr != head)
goto skip_queue;
idx++;
@@ -2133,8 +2137,6 @@ skip_queue:
if (pulled < max_nr_move && rem_load_move > 0) {
if (idx < this_best_prio)
this_best_prio = idx;
- if (idx == busiest_best_prio)
- busiest_best_prio_seen = 1;
if (curr != head)
goto skip_queue;
idx++;
next reply other threads:[~2006-04-25 3:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 3:08 Peter Williams [this message]
2006-04-25 16:28 ` [PATCH] sched: fix evaluation of skip_for_load in move_tasks() Siddha, Suresh B
2006-04-25 23:23 ` Peter Williams
2006-04-26 0:15 ` Siddha, Suresh B
2006-04-26 0:35 ` Peter Williams
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=444D9290.6070706@bigpond.net.au \
--to=pwil3058@bigpond.net.au \
--cc=akpm@osdl.org \
--cc=efault@gmx.de \
--cc=kenneth.w.chen@intel.com \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=suresh.b.siddha@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.