This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ports/16191] PAGE_SIZE defined constant on MIPS, but size is configurable


https://sourceware.org/bugzilla/show_bug.cgi?id=16191

--- Comment #3 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Andrew Stubbs from comment #0)
> The sys/user.h header defines PAGE_SIZE to a constant (4096), but that
> figure is not always accurate; the page size is a kernel configuration
> option.
...
> According to Andrew Pinski, the constant PAGE_SIZE is not appropriate on any
> MIPS variant, so at least some of the above macros can be removed. Other
> architectures appear to remove all of them, but it's not clear that that's
> correct on MIPS.

>From the standards point of view if we define PAGE_SIZE we must also define
PAGESIZE and in limits.h. We don't define PAGESIZE or PAGE_SIZE in limits.h,
and therefore there are no compile-time constants for these values in standards
compliant headers.

The question of what to do with sys/user.h PAGE_SIZE define is less clear. We
still define PAGE_SIZE for x86, x86_64, MIPS, MicroBlaze, s390, s390x, and
Alpha. It isn't clear what user application compatibility issues will arise if
we remove the PAGE_SIZE definition for MIPS.

I agree that if the kernel built-in page size is larger then user applications
making use of PAGE_SIZE won't work correctly. However, they will work correctly
and continue to compile correctly if the kernel page size matches.

The other problem is that there are several kernel headers that use PAGE_SIZE
(/usr/include/linux/binfmts.h, /usr/include/linux/resource.h,
/usr/include/linux/kvm.h), what happens to those if glibc stops defining
PAGE_SIZE for MIPS? What of the applications that use those headers?

How do you propose we tackle the issue of:

(a) Compatibility with applications expecting PAGE_SIZE to be defined?

and

(b) Kernel headers that require PAGE_SIZE?

Note: In glibc we use EXEC_PAGESIZE which must be as big as the largest kernel
page size, and that's your limiting factor to increasing the page size in the
kernel (otherwise mapping anything including dlopen'd libraries won't work
reliably). Once we've started up sufficiently we obviously use AT_PAGESZ to
determine the correct page size value and that's what is returned via sysconf
(_SC_PAGESIZE).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]