gcc/libgcc
Lipeng Zhu b806c88fab libgfortran: Replace mutex with rwlock
This patch try to introduce the rwlock and split the read/write to
unit_root tree and unit_cache with rwlock instead of the mutex to
increase CPU efficiency. In the get_gfc_unit function, the percentage
to step into the insert_unit function is around 30%, in most instances,
we can get the unit in the phase of reading the unit_cache or unit_root
tree. So split the read/write phase by rwlock would be an approach to
make it more parallel.

BTW, the IPC metrics can gain around 9x in our test
server with 220 cores. The benchmark we used is
https://github.com/rwesson/NEAT

libgcc/ChangeLog:

	* gthr-posix.h (__GTHREAD_RWLOCK_INIT): New macro.
	(__gthrw): New function.
	(__gthread_rwlock_rdlock): New function.
	(__gthread_rwlock_tryrdlock): New function.
	(__gthread_rwlock_wrlock): New function.
	(__gthread_rwlock_trywrlock): New function.
	(__gthread_rwlock_unlock): New function.

libgfortran/ChangeLog:

	* io/async.c (DEBUG_LINE): New macro.
	* io/async.h (RWLOCK_DEBUG_ADD): New macro.
	(CHECK_RDLOCK): New macro.
	(CHECK_WRLOCK): New macro.
	(TAIL_RWLOCK_DEBUG_QUEUE): New macro.
	(IN_RWLOCK_DEBUG_QUEUE): New macro.
	(RDLOCK): New macro.
	(WRLOCK): New macro.
	(RWUNLOCK): New macro.
	(RD_TO_WRLOCK): New macro.
	(INTERN_RDLOCK): New macro.
	(INTERN_WRLOCK): New macro.
	(INTERN_RWUNLOCK): New macro.
	* io/io.h (struct gfc_unit): Change UNIT_LOCK to UNIT_RWLOCK in
	a comment.
	(unit_lock): Remove including associated internal_proto.
	(unit_rwlock): New declarations including associated internal_proto.
	(dec_waiting_unlocked): Use WRLOCK and RWUNLOCK on unit_rwlock
	instead of __gthread_mutex_lock and __gthread_mutex_unlock on
	unit_lock.
	* io/transfer.c (st_read_done_worker): Use WRLOCK and RWUNLOCK on
	unit_rwlock instead of LOCK and UNLOCK on unit_lock.
	(st_write_done_worker): Likewise.
	* io/unit.c: Change UNIT_LOCK to UNIT_RWLOCK in 'IO locking rules'
	comment. Use unit_rwlock variable instead of unit_lock variable.
	(get_gfc_unit_from_unit_root): New function.
	(get_gfc_unit): Use RDLOCK, WRLOCK and RWUNLOCK on unit_rwlock
	instead of LOCK and UNLOCK on unit_lock.
	(close_unit_1): Use WRLOCK and RWUNLOCK on unit_rwlock instead of
	LOCK and UNLOCK on unit_lock.
	(close_units): Likewise.
	(newunit_alloc): Use RWUNLOCK on unit_rwlock instead of UNLOCK on
	unit_lock.
	* io/unix.c (find_file): Use RDLOCK and RWUNLOCK on unit_rwlock
	instead of LOCK and UNLOCK on unit_lock.
	(flush_all_units): Use WRLOCK and RWUNLOCK on unit_rwlock instead
	of LOCK and UNLOCK on unit_lock.
2023-12-11 09:43:59 -08:00
..
config libgcc: aarch64: Add SME unwinder support 2023-12-08 11:29:07 +00:00
soft-fp libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
ChangeLog Daily bump. 2023-12-09 00:17:30 +00:00
config.host arm: libgcc: provide implementations of __sync_synchronize 2023-11-24 14:15:26 +00:00
config.in libgcc: Fix config.in 2023-12-08 12:35:40 +00:00
configure libgcc: aarch64: Configure check for __getauxval 2023-12-08 11:29:06 +00:00
configure.ac libgcc: aarch64: Configure check for __getauxval 2023-12-08 11:29:06 +00:00
crtstuff.c Update copyright years. 2023-01-16 11:52:17 +01:00
dfp-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
dfp-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
divmod.c Update copyright years. 2023-01-16 11:52:17 +01:00
emutls.c libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c 2023-12-06 12:27:12 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2023-01-16 11:52:17 +01:00
find-symver.awk Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
fp-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
gbl-ctors.h Update copyright years. 2023-01-16 11:52:17 +01:00
gcov.h Update copyright years. 2023-01-16 11:52:17 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2023-01-16 11:52:17 +01:00
generic-morestack.c Update copyright years. 2023-01-16 11:52:17 +01:00
generic-morestack.h Update copyright years. 2023-01-16 11:52:17 +01:00
gstdint.h
gthr-posix.h libgfortran: Replace mutex with rwlock 2023-12-11 09:43:59 -08:00
gthr-single.h Update copyright years. 2023-01-16 11:52:17 +01:00
gthr.h Update copyright years. 2023-01-16 11:52:17 +01:00
hardcfr.c libgcc: mark __hardcfr_check_fail as always_inline 2023-11-23 17:31:40 +01:00
libgcc2.c libgcc _BitInt helper documentation [PR102989] 2023-09-06 17:42:37 +02:00
libgcc2.h Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
libgcc-std.ver.in Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
libgcov-driver-system.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-driver.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-interface.c libgcov: Call __builtin_fork instead of fork 2023-12-08 16:27:55 +01:00
libgcov-merge.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-profiler.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-util.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov.h gcov: Fix use of __LIBGCC_HAVE_LIBATOMIC 2023-12-01 09:54:24 +01:00
Makefile.in strub: enable conditional support 2023-12-07 12:58:20 -03:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2023-01-16 11:52:17 +01:00
mkmap-flat.awk Update copyright years. 2023-01-16 11:52:17 +01:00
mkmap-symver.awk Update copyright years. 2023-01-16 11:52:17 +01:00
offloadstuff.c openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
shared-object.mk
siditi-object.mk
static-object.mk
strub.c Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
sync.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivhi3.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmod.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmodhi4.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmodsi4.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-arm-common.inc Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-c.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-compat.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-compat.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-btree.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-execute_cfa.h libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-dw2-fde-compat.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-fde-dip.c libgcc: Fix -Wint-conversion warning in find_fde_tail 2023-07-11 06:19:39 +02:00
unwind-dw2-fde.c preserve base pointer for __deregister_frame [PR110956] 2023-08-11 09:20:27 -06:00
unwind-dw2-fde.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2.c libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-dw2.h libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-generic.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-pe.h [committed] Fix build of libgcc on ports using FDPIC 2023-12-02 22:45:48 -07:00
unwind-seh.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-sjlj.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind.inc Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_end_preinit.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_end.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_start_preinit.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_start.c Update copyright years. 2023-01-16 11:52:17 +01:00