On 12/11/2012 08:38 PM, Mathieu Desnoyers wrote: > * Lai Jiangshan ([email protected]) wrote: >> From 66f50786b9d5f1bcf2ad56e3a9ab905005c6cd90 Mon Sep 17 00:00:00 2001 >> From: Lai Jiangshan <[email protected]> >> Date: Tue, 11 Dec 2012 14:24:44 +0800 >> Subject: [PATCH] urcu: avoid false sharing for rcu_gp_ctr >> >> @rcu_gp_ctr and @registry share the same cache line, it causes >> false sharing and slowdown both of the read site and update site. >> >> Fix: Use different cache line for them. >> >> Although rcu_gp_futex is updated less than rcu_gp_ctr, but >> they always be accessed at almost the same time, so we also move rcu_gp_futex >> to the cacheline of rcu_gp_ctr to reduce the cacheline-usage or cache-missing >> of read site. >> >> test: (4X6=24 CPUs) >> >> Before patch: >> >> [root@localhost userspace-rcu]# ./tests/test_urcu_mb 20 1 20 >> SUMMARY ./tests/test_urcu_mb testdur 20 nr_readers 20 rdur 0 >> wdur 0 nr_writers 1 wdelay 0 nr_reads 2100285330 nr_writes >> 3390219 nr_ops 2103675549 >> [root@localhost userspace-rcu]# ./tests/test_urcu_mb 20 1 20 >> SUMMARY ./tests/test_urcu_mb testdur 20 nr_readers 20 rdur 0 >> wdur 0 nr_writers 1 wdelay 0 nr_reads 1619868562 nr_writes >> 3529478 nr_ops 1623398040 >> [root@localhost userspace-rcu]# ./tests/test_urcu_mb 20 1 20 >> SUMMARY ./tests/test_urcu_mb testdur 20 nr_readers 20 rdur 0 >> wdur 0 nr_writers 1 wdelay 0 nr_reads 1949067038 nr_writes >> 3469334 nr_ops 1952536372 >> >> after patch: >> >> [root@localhost userspace-rcu]# ./tests/test_urcu_mb 20 1 20 >> SUMMARY ./tests/test_urcu_mb testdur 20 nr_readers 20 rdur 0 >> wdur 0 nr_writers 1 wdelay 0 nr_reads 3380191848 nr_writes >> 4903248 nr_ops 3385095096 >> [root@localhost userspace-rcu]# ./tests/test_urcu_mb 20 1 20 >> SUMMARY ./tests/test_urcu_mb testdur 20 nr_readers 20 rdur 0 >> wdur 0 nr_writers 1 wdelay 0 nr_reads 3397637486 nr_writes >> 4129809 nr_ops 3401767295 >> >> Signed-off-by: Lai Jiangshan <[email protected]> >> --- >> Makefile.am | 10 +++++----- >> compat_rcu_gp.lds | 25 +++++++++++++++++++++++++ >> compat_rcu_gp_bp.lds | 24 ++++++++++++++++++++++++ >> compat_rcu_gp_mb.lds | 25 +++++++++++++++++++++++++ >> compat_rcu_gp_qsbr.lds | 25 +++++++++++++++++++++++++ >> compat_rcu_gp_signal.lds | 25 +++++++++++++++++++++++++ >> urcu-bp.c | 14 ++++---------- >> urcu-qsbr.c | 35 +++++++++++++++-------------------- >> urcu.c | 34 +++++++++++++--------------------- >> urcu/map/urcu-bp.h | 3 +-- >> urcu/map/urcu-qsbr.h | 3 +-- >> urcu/map/urcu.h | 9 +++------ >> urcu/static/urcu-bp.h | 23 ++++++++++++++--------- >> urcu/static/urcu-qsbr.h | 39 ++++++++++++++++++++++++--------------- >> urcu/static/urcu.h | 38 ++++++++++++++++++++++++-------------- >> 15 files changed, 228 insertions(+), 104 deletions(-) >> create mode 100644 compat_rcu_gp.lds >> create mode 100644 compat_rcu_gp_bp.lds >> create mode 100644 compat_rcu_gp_mb.lds >> create mode 100644 compat_rcu_gp_qsbr.lds >> create mode 100644 compat_rcu_gp_signal.lds >> >> diff --git a/Makefile.am b/Makefile.am >> index 0a4d357..b2b7b6a 100644 >> --- a/Makefile.am >> +++ b/Makefile.am >> @@ -56,21 +56,21 @@ lib_LTLIBRARIES = liburcu-common.la \ >> # >> liburcu_common_la_SOURCES = wfqueue.c wfcqueue.c wfstack.c $(COMPAT) >> >> -liburcu_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) >> +liburcu_la_SOURCES = urcu.c urcu-pointer.c compat_rcu_gp.lds $(COMPAT) > > Hrm, I tried your patch with "make V=1", and have not found any use of > those "lds" files. I'm not sure adding them as SOURCES is enough.
Use liburcu_mb_la_LDFLAGS = -Xlinker compat_rcu_gp_mb.lds instead! Result(nm .libs/liburcu-mb.so): 00000000002046e0 D rcu_flavor_mb 0000000000204a80 D rcu_gp_ctr_mb 0000000000204a88 A rcu_gp_futex_mb 0000000000204c60 b rcu_gp_lock 0000000000204a80 D rcu_gp_mb The type "A" makes me nervous, Do we expect this? And a new problem: liburcu.so is RCU_MB actually in my system, but compat_rcu_gp.lds uses rcu_gp_memb(RCU_MEMBARRIER), it can't work in my system, how to fix it? > >> liburcu_la_LIBADD = liburcu-common.la >> >> -liburcu_qsbr_la_SOURCES = urcu-qsbr.c urcu-pointer.c $(COMPAT) >> +liburcu_qsbr_la_SOURCES = urcu-qsbr.c urcu-pointer.c compat_rcu_gp_qsbr.lds >> $(COMPAT) >> liburcu_qsbr_la_LIBADD = liburcu-common.la >> >> -liburcu_mb_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) >> +liburcu_mb_la_SOURCES = urcu.c urcu-pointer.c compat_rcu_gp_mb.lds $(COMPAT) >> liburcu_mb_la_CFLAGS = -DRCU_MB >> liburcu_mb_la_LIBADD = liburcu-common.la _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
