For a spinlock it doesn't appear to be insoluble.
Suppose we do the following
For
spin_lock(&foo)
current->waiting = foo;
foo->waiting += current;
If foo is held
Check if foo is on current->locks
If it is then we shot ourself in the foot
Check if any member of foo->waiting is waiting on a lock
we hold (in current->locks)
If it is then we shot ourselves in both feet
When we get the lock
foo->waiting -= current;
foo->held = current;
current->locks = foo;
For
spin_unlock(&foo)
if(current->locks != foo)
We released the locks in the wrong order
remoe foo from current->locks
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/