the new pthread_cond_wait function is slow when in multi core environment

because of the queue. so we build old version function in an extra .so file.
you can use it by adding LD_PRELOAD=./libpthreadcond.so in front of your
program (eg: LD_PRELOAD=./libpthreadcond.so ./test).
use with-libpthreadcond to open the spec compile option.
This commit is contained in:
xuhuijie 2020-08-04 19:05:22 +08:00
parent b991e5dd47
commit 94a9b01b4e
2 changed files with 4967 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
%bcond_with bootstrap
%bcond_without werror
%bcond_without docs
%bcond_with libpthreadcond
%ifarch %{valgrind_arches}
%bcond_without valgrind
@ -59,7 +60,7 @@
##############################################################################
Name: glibc
Version: 2.31
Release: 3
Release: 4
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -92,6 +93,7 @@ Patch6013: Fix-CVE-2020-6096-002.patch
Patch6014: Disable-warnings-due-to-deprecated-libselinux-symbol.patch
Patch9000: delete-no-hard-link-to-avoid-all_language-package-to.patch
Patch9001: build-extra-libpthreadcond-so.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -462,6 +464,15 @@ pushd $builddir
make %{?_smp_mflags} -O -r %{glibc_make_flags}
popd
##############################################################################
# Build libpthreadcond
##############################################################################
%if %{with libpthreadcond}
cd nptl_2_17
sh build_libpthreadcondso.sh %{_target_cpu} $builddir
cd ..
%endif
##############################################################################
# Install glibc...
##############################################################################
@ -477,6 +488,10 @@ done
make -j1 install_root=$RPM_BUILD_ROOT install -C build-%{target}
%if %{with libpthreadcond}
cp build-%{target}/nptl/libpthreadcond.so $RPM_BUILD_ROOT%{_libdir}
%endif
pushd build-%{target}
# notice: we can't use parallel compilation because the localedata will use "localedef" command
@ -712,6 +727,10 @@ for module in compat files dns; do
done
grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist
%if %{with libpthreadcond}
echo "%{_libdir}/libpthreadcond.so" >> glibc.filelist
%endif
##############################################################################
# glibc "common" sub-package
##############################################################################
@ -1168,6 +1187,18 @@ fi
%doc hesiod/README.hesiod
%changelog
* Fri Aug 14 2020 Xu Huijie<546391727@qq.com> - 2.31-4
- since the new version of the pthread_cond_wait()
function has performance degradation in multi-core
scenarios, here is an extra libpthreadcond.so using
old version of the function. you can use it by adding
LD_PRELOAD=./libpthreadcond.so in front of your program
(eg: LD_PRELOAD=./libpthreadcond.so ./test).
use with-libpthreadcond to compile it.
warning:2.17 version pthread_cond_wait() does not meet
the posix standard, you should pay attention when using
it.
* Fri Jul 24 2020 Wang Shuo<wangshuo_1994@foxmail.com> - 2.31-3
- backport patch to disable warnings due to deprecated libselinux
- symbols used by nss and nscd