From: Ingo Molnar <mingo@elte.hu>
To: Nick Piggin <piggin@cyberone.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] 2.6.0 sched migrate comment
Date: Sat, 20 Dec 2003 21:26:11 +0100 [thread overview]
Message-ID: <20031220202611.GB32320@elte.hu> (raw)
In-Reply-To: <3FE468F5.7020501@cyberone.com.au>
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
* Nick Piggin <piggin@cyberone.com.au> wrote:
> Some comments were lost during minor surgery here...
this patch collides with John Hawkes' sched_clock() fix-patch which goes
in first. Also, the patch does more than just comment fixups. It changes
the order of tests, where a bug slipped in:
+ if (!idle && (delta <= cache_decay_ticks))
This will cause the cache-hot test to almost never trigger, which is
clearly incorrect. The correct test is:
if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks)))
anyway, i've fixed it all up (patch attached).
Ingo
[-- Attachment #2: sched-can-migrate-2.6.0-A1 --]
[-- Type: text/plain, Size: 1648 bytes --]
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -1193,25 +1193,25 @@ static inline void pull_task(runqueue_t
}
/*
- * Previously:
- *
- * #define CAN_MIGRATE_TASK(p,rq,this_cpu) \
- * ((!idle || (NS_TO_JIFFIES(now - (p)->timestamp) > \
- * cache_decay_ticks)) && !task_running(rq, p) && \
- * cpu_isset(this_cpu, (p)->cpus_allowed))
+ * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
*/
-
static inline int
can_migrate_task(task_t *tsk, runqueue_t *rq, int this_cpu, int idle)
{
unsigned long delta = rq->timestamp_last_tick - tsk->timestamp;
- if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks)))
- return 0;
+ /*
+ * We do not migrate tasks that are:
+ * 1) running (obviously), or
+ * 2) cannot be migrated to this CPU due to cpus_allowed, or
+ * 3) are cache-hot on their current CPU.
+ */
if (task_running(rq, tsk))
return 0;
if (!cpu_isset(this_cpu, tsk->cpus_allowed))
return 0;
+ if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks)))
+ return 0;
return 1;
}
@@ -1273,13 +1273,6 @@ skip_bitmap:
skip_queue:
tmp = list_entry(curr, task_t, run_list);
- /*
- * We do not migrate tasks that are:
- * 1) running (obviously), or
- * 2) cannot be migrated to this CPU due to cpus_allowed, or
- * 3) are cache-hot on their current CPU.
- */
-
curr = curr->prev;
if (!can_migrate_task(tmp, busiest, this_cpu, idle)) {
@@ -1289,6 +1282,8 @@ skip_queue:
goto skip_bitmap;
}
pull_task(busiest, array, tmp, this_rq, this_cpu);
+
+ /* Only migrate one task if we are idle */
if (!idle && --imbalance) {
if (curr != head)
goto skip_queue;
next prev parent reply other threads:[~2003-12-20 20:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-20 15:19 [PATCH 1/5] 2.6.0 fix preempt ctx switch accounting Nick Piggin
2003-12-20 15:20 ` [PATCH 2/5] 2.6.0 sched fork cleanup Nick Piggin
2003-12-20 15:21 ` [PATCH 3/5] 2.6.0 sched migrate comment Nick Piggin
2003-12-20 15:22 ` [PATCH 4/5] 2.6.0 sched style fixes Nick Piggin
2003-12-20 15:24 ` [PATCH 5/5] 2.6.0 sched affinity race Nick Piggin
2003-12-20 21:07 ` [PATCH 4/5] 2.6.0 sched style fixes Ingo Molnar
2003-12-20 20:26 ` Ingo Molnar [this message]
2003-12-20 23:19 ` [PATCH 3/5] 2.6.0 sched migrate comment Nick Piggin
2003-12-20 19:55 ` [PATCH 2/5] 2.6.0 sched fork cleanup Ingo Molnar
2003-12-20 23:17 ` Nick Piggin
2003-12-20 19:22 ` [PATCH 1/5] 2.6.0 fix preempt ctx switch accounting Ingo Molnar
2003-12-20 19:52 ` Rob Love
2003-12-20 20:07 ` Linus Torvalds
2003-12-20 21:32 ` Ingo Molnar
2003-12-20 23:15 ` Nick Piggin
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=20031220202611.GB32320@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=piggin@cyberone.com.au \
/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®