Re: Kernel patches enabling better POSIX AIO (Was Re: [3/4] kevent:AIO, aio_sendfile)

From: Ulrich Drepper
Date: Mon Aug 14 2006 - 12:37:39 EST

Suparna Bhattacharya wrote:
> Is there a (remote) possibility that the thread could have died and its
> pid got reused by a new thread in another process ? Or is there a mechanism
> that prevents such a possibility from arising (not just in NPTL library,
> but at the kernel level) ?

The UID/GID won't help you with dying processes. What if the same user
creates a process with the same PID? That process will not expect the
notification and mustn't receive it. If you cannot detect whether the
issuing process died you have problems which cannot be solved with a
uid/gid pair.

> AIO for pipes should not be a problem - Chris Mason had a patch, so we can
> just bring it up to the current levels, possibly with some additional
> improvements.


> I'm not sure what would be the right thing to do for the sockets case. While
> we could put together a patch for basic aio_read/write (based on the same
> model used for files), given the whole ongoing kevent effort, its not yet
> clear to me what would make the most sense ...
> Ben had a patch to do a fallback to kernel threads for AIO operations that
> are not yet supported natively. I had some concerns about the approach, but
> I guess he had intended it as an interim path for cases like this.

A fallback solution would be sufficient. Nobody _should_ use POSIX AIO
for networking but people do and just giving them something that works
is good enough. It cannot really be worse than the userlevel emulation
we have know.

The alternative, separately and sequentially handling network sockets at
userlevel is horrible. We'd have to go over every file descriptor and
check whether it's a socket and then take if out of the request list for
the kernel. Then they need to be handled separately before or after the
kernel AIO code. This would punish unduly all the 99.9% of the programs
which don't use POSIX AIO for network I/O.

â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â

Attachment: signature.asc
Description: OpenPGP digital signature