And also as Peter pointed out when I posted the patch (thank you Peter),
I did not properly handle the return value for try_to_wake_up() - a rather
fatal flaw.
By coincidence, I was about to post a new version of my scary patch when
this email arrived. I'll post my patches as a reply to this email, then
read through Peter's.
Frank's patch, Version 2
Changes from Version 1:
- Ensure return value of try_to_wake_up() is correct, even when queueing
wake up on a different cpu.
- rq->lock contention reduction not as good as first version
patch 1
The core changes. All the scary lock related stuff.
select_task_rq() uses the smp_processor_id() of the old task_cpu(p) instead
of the waking smp_processor_id().
patch 2
select_task_rq() uses the smp_processor_id() of the waking smp_processor_id()
Limitations
x86 only
Tests
- tested on 2 cpu x86_64
- very simplistic workload
- results:
rq->lock contention count reduced by ~ 75%
rq->lock contention wait time reduced by ~ 70%
test duration reduction is in the noise
rq->lock contention improvement is slightly better with just patch 1
applied, but the difference is in the noise
Todo
- handle cpu being offlined
-Frank
--