[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory address alignment and atomic operations.



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.


~velco


-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/