From f8ce8234aa7247c8f3a4317f5671b5fd40ffb8c8 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 7 Jun 2024 21:25:10 -0400 Subject: kernel: Add __cacheline_aligned macro This commit introduces a "__cacheline_aligned" macro which aligns data by the cache line size (COHERENCY_UNIT bytes). This is useful for heavily contended locks. Signed-off-by: Ian Moffett --- sys/arch/amd64/conf/link.ld | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/conf/link.ld b/sys/arch/amd64/conf/link.ld index b073054..9c47a81 100644 --- a/sys/arch/amd64/conf/link.ld +++ b/sys/arch/amd64/conf/link.ld @@ -32,7 +32,7 @@ SECTIONS . += CONSTANT(MAXPAGESIZE); .data : { - *(.data .data.*) + *(.data) } :data .bss : { @@ -40,6 +40,12 @@ SECTIONS *(.bss .bss.*) } :data + /* -- Cache line alignment -- */ + . = ALIGN(64); + .data.cacheline_aligned : { + *(.data.cacheline_aligned) + } + /DISCARD/ : { *(.eh_frame) *(.note .note.*) -- cgit v1.2.3