__read_only in the kernel

Adrian Chadd adrian.chadd at gmail.com
Mon Nov 28 16:27:12 UTC 2016


.. and it makes it easy to see (a) whether a variable has it, and (b)
whether a variable doesn't - just use grep.


-a


On 28 November 2016 at 07:16, Anton Yuzhaninov <citrin+bsd at citrin.ru> wrote:
> On 11/28/16 03:30, Ed Schouten wrote:
>>
>> 2016-11-27 22:25 GMT+01:00 Mateusz Guzik <mjguzik at gmail.com>:
>>>
>>> The somewhat standard way of combating parts of it for frequently read
>>> and rarely (if ever) modified variables is an annotation which puts
>>> them in a dedicated part of the binary and the somewhat standard name
>>> for a macro doing the work is __read_mostly.
>>
>>
>> Out of curiosity, what is the advantage of doing this?
>
>
> If a variable which read often shares CPU cache line with a variable updated
> often we have performance degradation. Each time second variable is updated
> first (read mostly) unnecessary flushed from CPU cache.
>
> Some data structures already aligned by cache line size to avoid false
> sharing, but moving read only / read mostly variables to separate section
> allows to avoid false sharing without spending memory on alignment (and
> alignment not always helps to avoid false sharing AFAIK).
>
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"


More information about the freebsd-arch mailing list