This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] Make bindresvport() function to multithread-safe


On Thu, Oct 25, 2012 at 03:26:09PM -0400, Carlos O'Donell wrote:
> > The bind() in kernelspace is already going to involve host-global
> > locks, so concurrency is not possible.
> 
> That's something I hadn't considered, and it's a good point.
> I see at the very least an rcu_read_lock() to try lookup the fd
> from the fs layer. However, it doesn't preclude doing a good job
> in userspace. If userspace can operate without taking a lock then
> all you need is a kernel upgrade to fix the other half of the problem.

That's fundamentally impossible. The kernel must guard against two
cores allocating the same port to different callers at the same time.
This lock cannot be eliminated.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]