From cf558f10a7abeda01e8e79a571df6af5c79bdd5b Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 6 Sep 2017 20:32:49 +0000 Subject: [PATCH] Introduce __read_frequently While __read_mostly groups variables together, their placement is not specified. In particular 2 frequently used variables can end up in different lines. This annotation is only expected to be used for variables read all the time, e.g. on each syscall entry. MFC after: 1 week --- sys/conf/ldscript.amd64 | 4 ++++ sys/sys/systm.h | 1 + 2 files changed, 5 insertions(+) diff --git a/sys/conf/ldscript.amd64 b/sys/conf/ldscript.amd64 index b2ca347a7c85..43fde20370bc 100644 --- a/sys/conf/ldscript.amd64 +++ b/sys/conf/ldscript.amd64 @@ -146,6 +146,10 @@ SECTIONS . = DATA_SEGMENT_RELRO_END (24, .); .got.plt : { *(.got.plt) } . = ALIGN(64); + .data.read_frequently : + { + *(.data.read_frequently) + } .data.read_mostly : { *(.data.read_mostly) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index b70a0d9ac690..30a25ef9620d 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -138,6 +138,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); * Align variables. */ #define __read_mostly __section(".data.read_mostly") +#define __read_frequently __section(".data.read_frequently") #define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \ __section(".data.exclusive_cache_line") /*