NetBSD/sys/modules/xldscripts/kmodule
mjf e0e10b0607 Add __cacheline_aligned and __read_mostly annotations.
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.
2010-06-01 22:13:30 +00:00

24 lines
535 B
Plaintext

/* $NetBSD: kmodule,v 1.2 2010/06/01 22:13:30 mjf Exp $ */
SECTIONS
{
/* Pre-loaded modules must have merged BSS and data. */
.data 0 :
{
*(.data)
*(.bss)
*(.bss.*)
*(COMMON)
}
. = ALIGN(64); /* COHERENCY_UNIT */
.data.cacheline_aligned : { *(.data.cacheline_aligned) }
. = ALIGN(64); /* COHERENCY_UNIT */
.data.read_mostly : { *(.data.read_mostly) }
. = ALIGN(64); /* COHERENCY_UNIT */
/* Pre-loaded modules do not need the following. */
/DISCARD/ :
{
*(.comment)
}
}