This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v8] Mutex: Add pthread mutex tunables
- From: kemi <kemi dot wang at intel dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Rical Jason <rj at 2c3t dot io>, Carlos Donell <carlos at redhat dot com>, Glibc alpha <libc-alpha at sourceware dot org>
- Cc: Dave Hansen <dave dot hansen at linux dot intel dot com>, Tim Chen <tim dot c dot chen at intel dot com>, Andi Kleen <andi dot kleen at intel dot com>, Ying Huang <ying dot huang at intel dot com>, Aaron Lu <aaron dot lu at intel dot com>, Lu Aubrey <aubrey dot li at intel dot com>
- Date: Mon, 16 Jul 2018 08:44:46 +0800
- Subject: Re: [PATCH v8] Mutex: Add pthread mutex tunables
- References: <firstname.lastname@example.org>
On 2018年07月10日 09:17, Kemi Wang wrote:
> This patch does not have any functionality change, we only provide a spin
> count tunes for pthread adaptive spin mutex. The tunable
> glibc.pthread.mutex_spin_count tunes can be used by system administrator to
> squeeze system performance according to different hardware capabilities and
> workload characteristics.
> The maximum value of spin count is limited to 30000 to avoid the overflow
> of mutex->__data.__spins variable with the possible type of short in
> pthread_mutex_lock ().
> The default value of spin count is set to 100 with the reference to the
> previous number of times of spinning via trylock. This value would be
> architecture-specific and can be tuned with kinds of benchmarks to fit most
> cases in future.
> * sysdeps/nptl/dl-tunables.list: Add glibc.pthread.mutex_spin_count entry.
> * manual/tunables.texi: Add glibc.pthread.mutex_spin_count description.
> * sysdeps/nptl/pthread_mutex_conf.h: New file.
> * nptl/pthread_mutex_conf.c: New file.
> * nptl/Makefile: Add pthread_mutex_conf.c for compilation.
> * nptl/nptl-init.c: Put pthread mutex tunable initialization in pthread
> * nptl/pthreadP.h: Move MAX_ADAPTIVE_COUNT macro definition to
> I would extend my appreciation sincerely to H.J.Lu for his help to refine
> this patch series.
> a) Refine the pthread tunables description in manual/tunables.texi
> accordingly to Carlos O'Donell and Rical Jason.
> a) Patch is refined by H.J.Lu
> a) Missing "pthread mutex tunables" entry in the menu of tunables.texi,
> add it.
> a) Put mutex tunable (glibc.mutex.spin_count) initialization as part of
> overall pthread initialization, that would avoid the extra relocation,
> as suggested by Florian Weimer. Thanks for pointing it out!
> b) Move the READ_ONLY_SPIN macro definition from the third patch to
> this patch
> a) Add comments in elf/dl-tunables.list
> a) Polish the description of glibc.mutex.spin_count tunable with the
> help from Rical Jasan.
> b) Get rid of the TUNABLE_CALLBACK_FNDECL macros in
> pthread_mutex_conf.c, as suggested by Florian Weimer.
> c) Adjust the default value of spin count to 100 with the reference of
> the previous spinning way via trylock.
> a) Renamed nptl/mutex-conf.h -> nptl/pthread_mutex_conf.h
> b) Renamed nptl/mutex-conf.c -> nptl/pthread_mutex_conf.c
> c) Change the Makefile to compile pthread_mutex_conf.c
> d) Modify the copyright "2013-2018" -> "2018" for new added files
> e) Fix the indentation issue (tab -> double space) in
> f) Remove the env alias LD_SPIN_COUNT in elf/dl-tunables.list
> g) Fix the typo errors and refresh glibc.mutex.spin_count tunable
> description in manual/tunables.texi.
> h) Fix the indentation issue in nptl/pthread_mutex_conf.c
> i) Fix the indentation issue for nested preprocessor (add one space for
> each level)
> Reviewed-by: Carlos O'Donell <email@example.com>
> Suggested-by: Andi Kleen <firstname.lastname@example.org>
> Signed-off-by: Kemi.wang <email@example.com>
Anything else I need to do for this patch?