spin locks and migrate_disable()
Hi Thomas,
Two questions about spin_lock() in include/linux/spinlock_rt.h.
(1) spin_lock() and related functions invoke migrate_disable() and migrate_enable(). These functions are created by your patch, sched-migrate-disable.patch, and are EXPORT_SYMBOL_GPL(). Would you be willing to change these to EXPORT_SYMBOL()?
(2) What is the purpose of the migrate_disable() in the spin lock? Is it a correctness issue, or a performance issue, or something else?
Thanks!
-Frank
Quoted 8 lines · Frank Rowand
Hi Thomas,
Two questions about
spin_lock()ininclude/linux/spinlock_rt.h.(1)
spin_lock()and related functions invokemigrate_disable()andmigrate_enable(). These functions are created by your patch, sched-migrate-disable.patch, and areEXPORT_SYMBOL_GPL(). Would you be willing to change these toEXPORT_SYMBOL()?
Sigh. Yes.
Quoted 2 lines
(2) What is the purpose of the
migrate_disable()in the spin lock? Is it a correctness issue, or a performance issue, or something else?
Correctness. spinlocks disable preemption in mainline and therefor migration. So you can access per cpu data in a spinlocked section. Now with RT the section becomes preemptible. The lock prevents reentrancy, but we could be migrated away so the task might access parts of the per cpu data on one and then on the other cpu. Not really a good idea. Therefor we disable migration.
Thanks,
tglx