Skip to contentSkip to conversation

spin locks and migrate_disable()

DISCUSSION Frank Rowand 2 participants 2 messages Mar 30, 2012 – Apr 13, 2012

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 8 lines · Frank Rowand

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()?

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