[patch 3/4] BFS 420: add task state check in ttwu

From: Hillf Danton
Date: Fri May 25 2012 - 09:35:38 EST


If the given state does not match task, no bother acquiring the global
runqueue lock.

--- a/kernel/sched/bfs.c Mon May 14 20:50:38 2012
+++ b/kernel/sched/bfs.c Fri May 25 20:28:00 2012
@@ -1583,6 +1583,8 @@ static bool try_to_wake_up(struct task_s
/* This barrier is undocumented, probably for p->state? ãã */
smp_wmb();

+ if (!(p->state & state))
+ goto out;
/*
* No need to do time_lock_grq as we only need to update the rq clock
* if we activate the task
@@ -1597,14 +1599,14 @@ static bool try_to_wake_up(struct task_s
if (task_queued(p) || task_running(p))
goto out_running;

- ttwu_activate(p, rq, wake_flags & WF_SYNC);
+ ttwu_activate(p, rq, !!(wake_flags & WF_SYNC));
success = true;

out_running:
ttwu_post_activation(p, rq, success);
out_unlock:
task_grq_unlock(&flags);
-
+out:
ttwu_stat(p, cpu, success);

put_cpu();
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/