[PATCH 3/3] nptl: Only initialize robust list at mutex usage
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Jul 29 22:43:40 GMT 2025
> Em 29 de jul. de 2025, à(s) 17:28, Florian Weimer <fweimer@redhat.com> escreveu:
>
> * Adhemerval Zanella:
>
>> The robust mutex kernel initialization is always performed at process
>> startup and thread creation, even when the process does not use any
>> robust mutexes. This patch moves the set_robust_issue syscall to
>> either when a robust process is initialized or used, saving the
>> syscall issue for processes that do not use robust mutexes.
>>
>> The field futex_offset is used as a sentinel to indicate whether the
>> struct pthread list is already initialized. This also allows to move
>> the __nptl_set_robust_list_avail from ld.so to libc.so, since there is
>> no need to initialize it at pthread startup.
>
> Why is this in optimization? It adds a function call to the robust
> mutex locking path.
Most process do not require robust mutexes, so it is one less syscall per thread. And the function call is done once per thread, to setup the syscall (the fast patch is done inline that checks the offset).
More information about the Libc-alpha
mailing list