[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070418154811.GA16842@elte.hu>
Date: Wed, 18 Apr 2007 17:48:11 +0200
From: Ingo Molnar <mingo@...e.hu>
To: S.Çağlar Onur <caglar@...dus.org.tr>
Cc: Christoph Pfister <christophpfister@...il.com>,
linux-kernel@...r.kernel.org,
Michael Lothian <mike@...eburn.co.uk>,
Christophe Thommeret <hftom@...e.fr>,
Jurgen Kofler <kaffeine@....net>,
Ulrich Drepper <drepper@...hat.com>
Subject: Re: Kaffeine problem with CFS
* S.Çağlar Onur <caglar@...dus.org.tr> wrote:
> - schedule();
> + msleep(1);
> which Ingo sends me to try also has the same effect on me. I cannot
> reproduce hangs anymore with that patch applied top of CFS while one
> console checks out SVN repos and other one compiles a small test
> software.
great! Could you please unapply the hack above and try the proper fix
below, does this one solve the hangs too?
Ingo
Index: linux/kernel/sched_fair.c
===================================================================
--- linux.orig/kernel/sched_fair.c
+++ linux/kernel/sched_fair.c
@@ -264,15 +264,26 @@ static void dequeue_task_fair(struct rq
/*
* sched_yield() support is very simple via the rbtree, we just
- * dequeue and enqueue the task, which causes the task to
- * roundrobin to the end of the tree:
+ * dequeue the task and move it to the rightmost position, which
+ * causes the task to roundrobin to the end of the tree.
*/
static void requeue_task_fair(struct rq *rq, struct task_struct *p)
{
dequeue_task_fair(rq, p);
p->on_rq = 0;
- enqueue_task_fair(rq, p);
+ /*
+ * Temporarily insert at the last position of the tree:
+ */
+ p->fair_key = LLONG_MAX;
+ __enqueue_task_fair(rq, p);
p->on_rq = 1;
+
+ /*
+ * Update the key to the real value, so that when all other
+ * tasks from before the rightmost position have executed,
+ * this task is picked up again:
+ */
+ p->fair_key = rq->fair_clock - p->wait_runtime + p->nice_offset;
}
/*
@@ -380,7 +391,10 @@ static void task_tick_fair(struct rq *rq
* Dequeue and enqueue the task to update its
* position within the tree:
*/
- requeue_task_fair(rq, curr);
+ dequeue_task_fair(rq, curr);
+ curr->on_rq = 0;
+ enqueue_task_fair(rq, curr);
+ curr->on_rq = 1;
/*
* Reschedule if another task tops the current one.
-
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