Re: tasks getting stuck on mmap_sem?

From: Linus Torvalds
Date: Tue Aug 17 2010 - 17:29:54 EST


Oh, and it strikes me when looking at the sparc rwsem-const.h that it
has some unsigned constants in it. I think

#define RWSEM_WAITING_BIAS 0xffff0000

is actually unsigned, because it's a hex constant that doesn't fit in
a signed int. So it's of type 'unsigned int' if I recall the C type
rules right.

(That's one of the really _subtle_ C type rules: hex constants
actually act differently from decimal constants).

So now RWSEM_ACTIVE_WRITE_BIAS is unsigned too.

The x86 constants are all explicitly signed.

Btw, Michel sent out an email saying:

FYI, I just verified that RWSEM_WAITING_BIAS is defined as signed on
all architectures except for ia64. So, this would be consistent with
the issue being observed only on ia64.

but I think he missed that subtlety of the C type system. Other architectures do

#define RWSEM_WAITING_BIAS (-0x00010000)

which is indeed signed, but Sparc is unsigned despite the lack of a "u".

Of course, maybe I only _think_ I know all the C typing rules. I might
be full of sh*t. It happens..I didn't actually look them up.

Linus


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/