> This is essentially the same struct as mine. I used the pid of the task,> where you use the address of the task. You use an atomic count, whereas> I used an ordinary int, guarded by the embedded spinlock.>>> > #define nestlock_lock(snl) \> > do { \> > if ((snl)->uniq == current) { \>> That would be able to read uniq while it is being written by something> else (which it can, according to the code below). It needs protection.

Nope, think about a case were it breaks. False negatives are not possiblebecause it is set by the same task and false positives either.

> Well, it's not assembler either, but at least it's easily comparable> with the nonrecursive version. It's essentially got an extra if and> an inc in the lock. That's all.

Well, there's a little difference. In case of contention, you loop withyour custom try lock while I used the optimized asm code inside spin_lock.But again, I believe we didn't lose anything with the removal of this code(nested/recursive locks) from the kernel.