Re: sys_mmap2 on different architectures
From: David S. Miller
Date: Wed Feb 22 2006 - 16:52:17 EST
From: "H. Peter Anvin" <hpa@xxxxxxxxx>
Date: Wed, 22 Feb 2006 13:45:46 -0800
> I've looked through the code for sys_mmap2 on several architectures, and
> it looks like some architectures plays by the "shift is always 12" rule,
> e.g. SPARC, and some expect userspace to actually obtain the page
> size, e.g. PowerPC and MIPS. On some architectures, e.g. x86 and ARM,
> the point is moot since PAGE_SIZE is always 2^12.
>
> a. Is this correct, or have I misunderstood the code?
>
> b. If so, is this right, or is this a bug? Right now both klibc and
> µClibc consider the latter a bug.
>
> c. Which architectures are affected which way?
Right.
On sparc32 we had the issue where we had a 8K page size
platform (sun4) and the rest were using 4K page size.
I can't even think why we do that fixed shift actually. I think Jakub
Jalinek thought this might be a way to make applications assuming
4K page size work on the 8K page size machines.
I'm going to say that you can feel free to fix this to use PAGE_SHIFT
correctly all the time. Applications should be calling getpagesize()
and not assume what that value might be.
Please double check that we report the correct page size to userspace
and not a fixed 4K value :-)
-
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/