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
This commit is contained in:
Mateusz Guzik 2017-09-06 20:32:49 +00:00
parent fe933c1d88
commit cf558f10a7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323235
2 changed files with 5 additions and 0 deletions

View File

@ -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)

View File

@ -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")
/*