This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Make fprintf() function to multithread-safe
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Peng Haitao <penght at cn dot fujitsu dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 10 Jul 2012 02:18:16 -0700 (PDT)
- Subject: Re: [PATCH v3] Make fprintf() function to multithread-safe
- References: <1340257789-14975-1-git-send-email-penght@cn.fujitsu.com><1341891266-456-1-git-send-email-penght@cn.fujitsu.com>
There is no need to target individuals in your email.
Just post to the list.
Please file a bugzilla report for this issue.
I am not at all sanguine about taking any global locks in vfprintf,
even a reader lock. It is a code path that is extremely common and
often performance-critical. Conversely, register_printf_specifier
et al are called very rarely and their performance never matters much.
I think it's worth investigating an alternative approach where
changes work by allocating a new table and replacing the old one
with atomic operations. There is complexity there about tracking
when it's safe to free the old table, so it's not a trivial change.
Perhaps the reader locks are in fact just as efficient (for the
reader) as anything that could be done with the atomic-supersede
style. But I think it merits some real investigation and concrete
performance analysis.
Thanks,
Roland