Re: [PATCH] kexec jump: fix compiling warning on xchg(&kexec_lock,0) in kernel_kexec()

From: Linus Torvalds
Date: Wed Aug 13 2008 - 12:58:49 EST




On Wed, 13 Aug 2008, Huang Ying wrote:
>
> - xchg(&kexec_lock, 0);
> + locked = xchg(&kexec_lock, 0);
> + BUG_ON(!locked);

Why do you want to do this at all?

And why do you implement your locks with xchg() in the first place? That's
total and utter crap.

Hint: we have _real_ locking primitives in the kernel.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/