Momchil Velikov wrote:
Jon Masters wrote:
Tetsuo Handa wrote:
9: void add_tail(FOO *next) {
10: static spinlock_t lock = SPIN_LOCK_UNLOCKED;
11: FOO *f = &first;
12: spin_lock(&lock);
You just declared a local spinlock on the stack and then lock and
unlock it diligently - who is going to contend with you for that
resource?
It is not on the stack.
Sorry, missed the static in my parsing. My bad.
Jon.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/