e0e10b0607
These annotations help to mitigate false sharing on multiprocessor systems. Variables annotated with __cacheline_aligned are placed into the .data.cacheline_aligned section in the kernel. Each item in this section is aligned on a cachline boundary - this avoids false sharing. Highly contended global locks are a good candidate for __cacheline_aligned annotation. Variables annotated with __read_mostly are packed together tightly into a .data.read_mostly section in the kernel. The idea here is that we can pack infrequently modified data items into a cacheline and avoid having to purge the cache, which would happen if read mostly data and write mostly data shared a cachline. Initialisation variables are a prime candiate for __read_mostly annotations.
69 lines
1.5 KiB
Plaintext
69 lines
1.5 KiB
Plaintext
/* $NetBSD: kern.ldscript.2MB,v 1.3 2010/06/01 22:13:30 mjf Exp $ */
|
|
|
|
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
|
|
"elf64-x86-64")
|
|
OUTPUT_ARCH(i386:x86-64)
|
|
ENTRY(_start)
|
|
SECTIONS
|
|
{
|
|
/* Read-only sections, merged into text segment: */
|
|
.text :
|
|
AT (ADDR(.text))
|
|
{
|
|
*(.text)
|
|
*(.text.*)
|
|
*(.stub)
|
|
} =0
|
|
_etext = . ;
|
|
PROVIDE (etext = .) ;
|
|
|
|
.rodata :
|
|
AT (LOADADDR(.text) + (ADDR(.rodata) - ADDR(.text)))
|
|
{
|
|
*(.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 :
|
|
AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
|
|
{
|
|
*(.data)
|
|
}
|
|
. = ALIGN(64); /* COHERENCY_UNIT */
|
|
.data.cacheline_aligned :
|
|
AT (LOADADDR(.text) + (ADDR(.data.cacheline_aligned) - ADDR(.text)))
|
|
{
|
|
*(.data.cacheline_aligned)
|
|
}
|
|
. = ALIGN(64); /* COHERENCY_UNIT */
|
|
.data.read_mostly :
|
|
AT (LOADADDR(.text) + (ADDR(.data.read_mostly) - ADDR(.text)))
|
|
{
|
|
*(.data.read_mostly)
|
|
}
|
|
. = ALIGN(64); /* COHERENCY_UNIT */
|
|
_edata = . ;
|
|
PROVIDE (edata = .) ;
|
|
__bss_start = . ;
|
|
.bss :
|
|
AT (LOADADDR(.text) + (ADDR(.bss) - ADDR(.text)))
|
|
{
|
|
*(.bss)
|
|
*(.bss.*)
|
|
*(COMMON)
|
|
. = ALIGN(64 / 8);
|
|
}
|
|
. = ALIGN(64 / 8);
|
|
_end = . ;
|
|
PROVIDE (end = .) ;
|
|
.note.netbsd.ident :
|
|
{
|
|
KEEP(*(.note.netbsd.ident));
|
|
}
|
|
}
|