This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [PATCH] PAGE_SIZE definition for MIPS XLP
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Andrew Stubbs <ams at codesourcery dot com>, "libc-ports at sourceware dot org" <libc-ports at sourceware dot org>
- Date: Tue, 19 Nov 2013 20:56:24 +0000
- Subject: Re: [PATCH] PAGE_SIZE definition for MIPS XLP
- Authentication-results: sourceware.org; auth=none
- References: <528A0813 dot 10005 at codesourcery dot com> <CA+=Sn1nSOoXDFzmCbBEREJiQCxg_GoPXf6QNBS5UFRmQMVng8A at mail dot gmail dot com>
On Tue, 19 Nov 2013, Andrew Pinski wrote:
> > MIPS' sys/user.h currently has a constant definition for PAGE_SIZE, and the
> > other related settings. This is not appropriate for XLP (and other MIPS?)
> > where the actual page size is a kernel configuration option.
>
> The whole Octeon series of MIPS64 processors also supports other
> PAGE_SIZEs. Also the generic MIPS glibc should support other page
> sizes too.
Virtually all MIPS processors that have a TLB MMU, except a few old
oddballs, support a configurable page size (on a page-by-page basis, but
Linux sets the size globally). The exceptions are the R2000/R3000 MIPS I
ISA CPUs and their variations (fixed 4kB page size) and the R6000 MIPS II
ISA CPU (fixed 16kB page size). The latter hardly ever seen anywhere
(being a costly ECL discrete CPU chip set) and never supported by Linux.
Therefore there's no point ever in hardcoding any particular page size for
the MIPS port.
Of the sizes offered by standard hardware, ranging from 1kB up to 256TB
at the every other power of 2, Linux chose to support 4kB, 16kB and 64kB
pages.
> > Apart from the general principle of not having incorrect definitions, the
> > actual problem that needs to be solved is in
> > sysdeps/unix/sysv/linux/ifaddrs.c in which PAGE_SIZE is used by preference
> > as an optimization. Most of the other possible use cases prefer to call
> > __getpagesize or use sysconf, and so are unaffected.
The case of ifaddrs.c seems ill-conceived to me. If such a kind of
optimisation is desired, then I think on targets that have a fixed page
size getpagesize should simply be implemented as a static inline function
so that GCC can reduce any calls to an instantiation of the constant
returned.
Maciej