This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v4] Make bindresvport() function to multithread-safe
- From: Andreas Jaeger <aj at suse dot com>
- To: libc-alpha at sourceware dot org
- Cc: Carlos O'Donell <carlos at systemhalted dot org>,Peng Haitao <penght at cn dot fujitsu dot com>,Roland McGrath <roland at hack dot frob dot com>
- Date: Mon, 01 Oct 2012 09:59:40 +0200
- Subject: Re: [PATCH v4] Make bindresvport() function to multithread-safe
- References: <1348823725-18793-1-git-send-email-penght@cn.fujitsu.com> <CAE2sS1hJLkePJXMw8wCXQ48einUnvjPSbjX11LMzCVvT3i3zZg@mail.gmail.com>
On Friday, September 28, 2012 10:27:56 Carlos O'Donell wrote:
> On Fri, Sep 28, 2012 at 5:15 AM, Peng Haitao <penght@cn.fujitsu.com>
wrote:
> > bindresvport() uses a static variable port which is not protected.
> > It is not safe when in multithread circumstance.
> >
> > bindresvport() select a port number from the range 512 to 1023, when
> > in multithread circumstance, the port may be 1024. So the static
> > variable will be protected.
>
> Roland, Andreas,
>
> Do you have any comments on this?
>
> Looks like performance goes *up* when we switch to a __thread variable
> and use gettid, but I've asked Peng to justify this.
>
> http://sourceware.org/ml/libc-alpha/2012-09/msg00744.html
The performance numbers look fine to me and - besides some details that
can be sorted out - the patch looks fine as well.
The problem I have with the patch is that there's no rationale why this
patch is really needed. glibc is not threadsafe - but glibc is not
claiming it to be thread-safe either. As a quality of service
implementation we could make it thread-safe but why is that suddenly
needed? The referenced bug report also does not say it.
Peng, why do you think this patch is necessary? Is bindresvport thread
safe on other platforms?
Btw. Is this substential enough to need a copyright assignment and is
there one for Peng Haitao?
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126