[lttng-dev] [PATCH] [URCU] Allow forcing the use of sys membarrier
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Fri Sep 16 19:58:21 UTC 2016
----- On Sep 16, 2016, at 11:38 AM, Duncan Sands duncan.sands at deepbluecap.com wrote:
> Hi Mathieu,
>
> On 09/12/2016 05:05 PM, Mathieu Desnoyers wrote:
>> ----- On Sep 6, 2016, at 9:07 AM, Duncan Sands duncan.sands at deepbluecap.com
>> wrote:
>>
>>> When using the RCU_MEMBARRIER flavour of userspace-RCU, kernel support for
>>> sys-membarrier is detected dynamically and stored in the rcu_has_sys_membarrier
>>> global variable. Checking the value of this variable adds a small but
>>> measurable overhead to smp_mb_slave. I only use userspace-rcu on systems which
>>> support sys-membarrier, and I'd like a way of avoiding that overhead.
>>>
>>> The attached patch makes the following changes: if RCU_FORCE_SYS_MEMBARRIER is
>>> defined then rcu_has_sys_membarrier is replaced with the constant 1, eliminating
>>> the overhead in smp_mb_slave. As a sanity check, support for sys-membarrier is
>>> still detected at startup and if it isn't supported then the program aborts.
>>>
>>> I didn't try to integrate this feature into the build system (eg by adding a
>>> configure option for it) since I'm using my own build system.
>>
>> Hi Duncan,
>>
>> This is an interesting improvement. I'd be interested to merge it if it was
>> integrated with the liburcu build system. Perhaps a
>> --disable-dynamic-membarrier-check
>> at configure ?
>
> how about the attached patch?
I pushed the following commit into urcu master, inspired from your patch,
commit d8d9a3405ce46af6d34d2e80e260ad50f3d211a0
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Fri Sep 16 15:15:41 2016 -0400
Allow forcing the use of sys membarrier
When using the default (liburcu.so) and bulletproof (liburcu-bp.so)
flavours of Userspace RCU, kernel support for sys-membarrier is detected
dynamically and stored in the rcu_has_sys_membarrier_memb and
urcu_bp_has_sys_membarrier global variables.
Checking the value of these variables adds a small but measurable overhead
to smp_mb_slave. On systems which support sys-membarrier, it would be
nice to have a way of avoiding that overhead.
Here is the proposed approach: if CONFIG_RCU_FORCE_SYS_MEMBARRIER is
defined then rcu_has_sys_membarrier_memb/urcu_bp_has_sys_membarrier are
replaced with the constant 1, eliminating the overhead in smp_mb_slave.
As a sanity check, support for sys-membarrier is still detected at
startup. A program using liburcu or liburcu-bp compiled with this option
aborts in the library constructor if the membarrier system call is not
supported by the operating system.
Suggested-by: Duncan Sands <duncan.sands at deepbluecap.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Thanks !!
Mathieu
>
> Ciao, Duncan.
>
>>
>> Thanks,
>>
>> Mathieu
>>
>>>
>>> Best wishes, Duncan.
>>>
>>> _______________________________________________
>>> lttng-dev mailing list
>>> lttng-dev at lists.lttng.org
>>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list