sched: current instead rq->current
From: Colin Vidal
Date: Mon Aug 15 2016 - 15:30:50 EST
Hello,
At the beginning of __schedule (kernel/sched/core.c), the current task
is get with rq->curr. I try to to understand why not directly using
current instead?
Since a runqueue is specific to a CPU, it dosen't make sense to get the
the current task of another CPU's runqueue. Yes?
I try the following of Linus's master branch
-ÂÂÂÂÂÂÂint cpu;
Â
-ÂÂÂÂÂÂÂcpu = smp_processor_id();
-ÂÂÂÂÂÂÂrq = cpu_rq(cpu);
-ÂÂÂÂÂÂÂprev = rq->curr;
+ÂÂÂÂÂÂÂrq = cpu_rq(smp_processor_id());
+ÂÂÂÂÂÂÂprev = current;
and it seems to work (only tested on x86-64), but... To simple?
Thanks!
Colin