CPU1:
add_wait_queue(&WAKE_LIST)
/* smp safe function, adds us to WAKE_LIST */
xchg(TASK_UNINTERRUITPBLE, ¤t->state);
/* use xchg to force memory ordering */
if(inode->i_state & I_LOCK) {
schedule();
/* this function only returns if current->state
is TASK_RUNNING */
}
printk(KERN_DEBUG "no lock-up!\n");
CPU2:
inode->i_state &= ~I_LOCK;
/* we are the only thread that has write access to
this variable, no "lock;" required */
wake_up(&WAKE_LIST);
/* smp safe function, sets current->state of all
entries in WAKE_LIST back to TASK_RUNNING */
I think that Andrea want's to know if he could replace the xchg with a
normal "mov" instruction.
"smp safe function" means that they begin with a spin_lock(), ie
"lock;bts"
Btw, thank you for your clarification of the spin_unlock question,
Manfred Spraul
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/