diff mbox series

[v2] mips: Add <bits/pagesize.h>

Message ID 871q0ygb4o.fsf@oldenburg.str.redhat.com
State New
Headers show
Series [v2] mips: Add <bits/pagesize.h> | expand

Commit Message

Florian Weimer Oct. 2, 2024, 8:30 a.m. UTC
According to arch/mips/Kconfig in the Linux sources, MIPS supports
4 KiB, 8 KiB, 16 KiB, 32 KiB, 64 KiB page sizes depending on
CPU/configuration.

The new header is Linux-specific, to reflect that MIPS has a
software-defined TLB, and that the page size can be configured by the
kernel within a wide range.

---
v2: Change location of the file.
 sysdeps/unix/sysv/linux/mips/bits/pagesize.h | 2 ++
 1 file changed, 2 insertions(+)


base-commit: 069808403466af989cf08f74c77fcc1025980283

Comments

Maciej W. Rozycki Oct. 2, 2024, 10:17 a.m. UTC | #1
On Wed, 2 Oct 2024, Florian Weimer wrote:

> According to arch/mips/Kconfig in the Linux sources, MIPS supports
> 4 KiB, 8 KiB, 16 KiB, 32 KiB, 64 KiB page sizes depending on
> CPU/configuration.
> 
> The new header is Linux-specific, to reflect that MIPS has a
> software-defined TLB, and that the page size can be configured by the
> kernel within a wide range.

 Note that hardware provides for the page size to be set on a page-by-page 
basis, as the page mask is carried along with individual TLB entries.  An 
OS kernel can therefore arrange for a mixture of sizes to be used where 
required.  The MIPS port of Linux makes use of this feature for huge page 
support only, but I guess it could also be used to have a per-program MMU 
configuration based on information such as alignment restrictions obtained 
from ELF program headers.  It could be an interesting project to do, but I 
guess largely academic now given the gradual decline of the architecture.

Reviewed-by: Maciej W. Rozycki <macro@redhat.com>

  Maciej
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/mips/bits/pagesize.h b/sysdeps/unix/sysv/linux/mips/bits/pagesize.h
new file mode 100644
index 0000000000..cd688d3fb0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/pagesize.h
@@ -0,0 +1,2 @@ 
+#define __GLIBC_PAGE_SHIFT_MIN 12
+#define __GLIBC_PAGE_SHIFT_MAX 16