Re: [PATCH 1/12]: MUTEX: Implement mutexes

From: Russell King
Date: Sun Dec 18 2005 - 04:34:09 EST


On Sat, Dec 17, 2005 at 10:30:41PM -0800, Linus Torvalds wrote:
> An interrupt can never change the value without changing it back, except
> for the old-fashioned use of "up()" as a completion (which I don't think
> we do any more - we used to do it for IO completion a looong time ago).

I doubt you can guarantee that statement, or has the kernel source
been audited for this recently?

However, the real consideration is stability - if a semaphore was
used for a completion and it was merged, would it be found and
fixed? Probably not, because it won't cause any problems on
architectures where semaphores have atomic properties. Unless
of course sparse can be extended to detect the use of unbalanced
semaphores in interrupt contexts.

> (Of course, maybe it's not worth it. It might not be a big performance
> issue).

Balancing the elimination of 4 instructions per semaphore operation,
totalling about 4 to 6 cycles, vs stability I'd go for stability
unless we can prove the above assertion via (eg) sparse.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
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/