Messages in this thread | | | Subject | Re: [PATCH] sched: correct testing need_resched in mutex_spin_on_owner() | From | Peter Zijlstra <> | Date | Tue, 07 Jun 2011 17:20:40 +0200 |
| |
On Tue, 2011-06-07 at 22:47 +0800, Hillf Danton wrote: > Oh, it looks you are willing to rethink about testing need_resched?
Dude, however did you come up with that deduction?
mutex_spin_on_owner() does two things:
- it validates that owner is in fact still running (if so it must be on another cpu, since we're running on this one).
- it ensures we play nice and reschedule when we need to, so we don't hog our cpu.
Testing TIF_NEED_RESCHED on owner like you propose is wrong because:
- owner is not a stable pointer you can dereference, see owner_running(), you first need to validate that its still a valid pointer and then keep it valid while dereferencing it.
- if owner were to reschedule, it would leave the cpu and we'd break out of the loop anyway by means of owner_running() failing, so its superfluous.
Please, get a grip on reality and stop sending endless streams of patches based on wrong assumptions and mis-understandings.
| |