[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAJd=RBCgSSeWiPtRLg=OCOZW+0Ya1b-fDT3wNE1zFcXASYkxsA@mail.gmail.com>
Date: Fri, 15 Jun 2012 20:14:39 +0800
From: Hillf Danton <dhillf@...il.com>
To: LKML <linux-kernel@...r.kernel.org>,
Hillf Danton <dhillf@...il.com>
Subject: [patch] BFS 421: do ttwu stat outside runqueue lock
Change the site of ttwu stat out of the cover of runqueue lock.
--- a/kernel/sched/bfs.c Thu Jun 14 20:08:06 2012
+++ b/kernel/sched/bfs.c Fri Jun 15 19:55:18 2012
@@ -1124,31 +1124,6 @@ static inline void unstick_task(struct r
*/
static inline void take_task(int cpu, struct task_struct *p)
{
-#ifdef CONFIG_SCHEDSTATS
-#ifdef CONFIG_SMP
- //do ttwu stat outside grq lock, urgent?
- if (p->wakeup_cpu == -1)
- goto skip;
-
- if (cpu == p->wakeup_cpu) {
- schedstat_inc(cpu_rq(cpu), ttwu_local);
- }
- else if (cpu_online(p->wakeup_cpu)) {
- struct sched_domain *sd;
-
- rcu_read_lock();
- for_each_domain(p->wakeup_cpu, sd) {
- if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
- schedstat_inc(sd, ttwu_wake_remote);
- break;
- }
- }
- rcu_read_unlock();
- }
- p->wakeup_cpu = -1;
-skip:
-#endif
-#endif
#ifdef CONFIG_SMP
if (p != current) {
tsk_csw++;
@@ -3255,6 +3230,8 @@ need_resched:
++*switch_count;
context_switch(rq, prev, next); /* unlocks the grq */
+#ifdef CONFIG_SCHEDSTATS
+#ifdef CONFIG_SMP
/*
* The context switch have flipped the stack from under us
* and restored the local variables which were saved when
@@ -3264,6 +3241,29 @@ need_resched:
cpu = smp_processor_id();
rq = cpu_rq(cpu);
idle = rq->idle;
+ next = rq->curr;
+ if (next == idle || next->wakeup_cpu < 0)
+ goto skip;
+
+ if (cpu == next->wakeup_cpu)
+ schedstat_inc(rq, ttwu_local);
+
+ else if (cpu_online(next->wakeup_cpu)) {
+ struct sched_domain *sd;
+
+ rcu_read_lock();
+ for_each_domain(next->wakeup_cpu, sd) {
+ if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
+ schedstat_inc(sd, ttwu_wake_remote);
+ break;
+ }
+ }
+ rcu_read_unlock();
+ }
+ next->wakeup_cpu = -1;
+skip:
+#endif
+#endif
} else
grq_unlock_irq();
--
--
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