Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/conf Large pages are supported by default for...



details:   https://anonhg.NetBSD.org/src/rev/3d324bd7eb23
branches:  trunk
changeset: 345095:3d324bd7eb23
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat May 07 12:45:55 2016 +0000

description:
Large pages are supported by default for the text+rodata segments. Apply
the proper alignment for the data segment, so that more pages can benefit
from it. Reduces TLB contention.

kern.ldscript.2MB and largepages.inc are useless.

diffstat:

 sys/arch/amd64/conf/kern.ldscript     |  17 ++++++--
 sys/arch/amd64/conf/kern.ldscript.2MB |  69 -----------------------------------
 sys/arch/amd64/conf/largepages.inc    |   7 ---
 3 files changed, 13 insertions(+), 80 deletions(-)

diffs (119 lines):

diff -r fd6f59209bbd -r 3d324bd7eb23 sys/arch/amd64/conf/kern.ldscript
--- a/sys/arch/amd64/conf/kern.ldscript Sat May 07 12:36:50 2016 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript Sat May 07 12:45:55 2016 +0000
@@ -1,7 +1,15 @@
-/*     $NetBSD: kern.ldscript,v 1.16 2015/11/14 14:01:23 maxv Exp $    */
+/*     $NetBSD: kern.ldscript,v 1.17 2016/05/07 12:45:55 maxv Exp $    */
 
 #include "assym.h"
 
+/*
+ * PAE is enabled by default on amd64, the large page size is therefore
+ * 2MB (and not 4MB!).
+ */
+
+__PAGE_SIZE = 0x1000 ;
+__LARGE_PAGE_SIZE = 0x200000 ;
+
 ENTRY(_start)
 SECTIONS
 {
@@ -22,10 +30,11 @@
        }
 
        /*
-        * Adjust the address for the data segment.  We want to adjust up to
-        * the same address within the page on the next page up.
+        * Push the data segment up to the next large page boundary so that we
+        * can map the text+rodata segments with large pages.
         */
-       . = ALIGN(0x100000) + (. & (0x100000 - 1));
+       . = ALIGN(__LARGE_PAGE_SIZE);
+
        __data_start = . ;
        .data :
        {
diff -r fd6f59209bbd -r 3d324bd7eb23 sys/arch/amd64/conf/kern.ldscript.2MB
--- a/sys/arch/amd64/conf/kern.ldscript.2MB     Sat May 07 12:36:50 2016 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*     $NetBSD: kern.ldscript.2MB,v 1.11 2015/08/25 08:07:24 uebayasi Exp $    */
-
-#include "assym.h"
-
-ENTRY(_start)
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  .text :
-  {
-    *(.text)
-    *(.text.*)
-    *(.stub)
-  }
-  _etext = . ;
-  PROVIDE (etext = .) ;
-
-  .rodata :
-  {
-    *(.rodata)
-    *(.rodata.*)
-  }
-
-  /* Adjust the address for the data segment.  We push the data segment
-     up to the next 2MB boundary so that we can map the text with large
-     pages. */
-  . = ALIGN(0x200000);
-  __data_start = . ;
-  .data :
-  {
-    *(.data)
-  }
-  . = ALIGN(COHERENCY_UNIT);
-  .data.cacheline_aligned :
-  {
-    *(.data.cacheline_aligned)
-  }
-  . = ALIGN(COHERENCY_UNIT);
-  .data.read_mostly :
-  {
-    *(.data.read_mostly)
-  }
-  . = ALIGN(COHERENCY_UNIT);
-  _edata = . ;
-  PROVIDE (edata = .) ;
-  __bss_start = . ;
-  .bss :
-  {
-    *(.bss)
-    *(.bss.*)
-    *(COMMON)
-    . = ALIGN(64 / 8);
-  }
-  . = ALIGN(64 / 8);
-  _end = . ;
-  PROVIDE (end = .) ;
-  .note.netbsd.ident :
-  {
-    KEEP(*(.note.netbsd.ident));
-  }
-}
-SECTIONS
-{
-  .text :
-  AT (ADDR(.text))
-  {
-    *(.text)
-  } =0
-}
diff -r fd6f59209bbd -r 3d324bd7eb23 sys/arch/amd64/conf/largepages.inc
--- a/sys/arch/amd64/conf/largepages.inc        Sat May 07 12:36:50 2016 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#      $NetBSD: largepages.inc,v 1.4 2015/08/21 02:02:00 uebayasi Exp $
-#
-# Options to create a kernel suitable for mapping with large
-# pages.
-#
-
-makeoptions    KERNLDSCRIPT="kern.ldscript.2MB"



Home | Main Index | Thread Index | Old Index