[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070417082628.GD5076@elte.hu>
Date: Tue, 17 Apr 2007 10:26:31 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Nick Piggin <npiggin@...e.de>
Cc: Davide Libenzi <davidel@...ilserver.org>,
Gene Heskett <gene.heskett@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Con Kolivas <kernel@...ivas.org>,
Mike Galbraith <efault@....de>,
Arjan van de Ven <arjan@...radead.org>,
Peter Williams <pwil3058@...pond.net.au>,
Thomas Gleixner <tglx@...utronix.de>, caglar@...dus.org.tr,
Willy Tarreau <w@....eu>,
Dmitry Adamushko <dmitry.adamushko@...il.com>
Subject: Re: [patch] CFS (Completely Fair Scheduler), v2
* Nick Piggin <npiggin@...e.de> wrote:
> Actually I think this is something that makes sense to add, even if
> just for debugging, but maybe also for production, depending on how
> much it impacts things. Child runs first is an heuristic optimisation
> that exploits a VM detail (however fundamental). But for things that
> don't exec right after forking (and maybe some things that do), it can
> be nicer to reduce context switches, improve cache patterns, and allow
> children to be load balanced away before touching memory, if
> child_runs_first is turned off.
yeah, the primary intent was debug. Nick, am i confused to conclude that
mainline in fact runs the _parent_ first, despite all the elaborate
runqueue juggling we do there? This piece of code in wake_up_new_task()
caught my eyes:
p->prio = current->prio;
p->normal_prio = current->normal_prio;
list_add_tail(&p->run_list, ¤t->run_list);
p->array = current->array;
p->array->nr_active++;
inc_nr_running(p, rq);
shouldnt the list_add_tail() be list_add(), so that task pickup sees the
child first? Maybe we still do child-runs-first in practice, due to the
timeslice and sleep average fixups that happen if the parent preempts,
but the above piece of code seems a quite elaborate way of doing
activate_task(). To have the child _before_ the parent we'd need the
add-on patch below. But ... i could be wrong, this is just a quick
thought.
Ingo
---
kernel/sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -1685,7 +1685,7 @@ void fastcall wake_up_new_task(struct ta
else {
p->prio = current->prio;
p->normal_prio = current->normal_prio;
- list_add_tail(&p->run_list, ¤t->run_list);
+ list_add(&p->run_list, ¤t->run_list);
p->array = current->array;
p->array->nr_active++;
inc_nr_running(p, rq);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists