Re: [PATCH] Re: aio_poll in 2.6?

Andrew Morton
2003-05-17T02:35:50Z

John Myers <jgmyers@netscape.com> wrote:
>
> It's basically waiting for someone to merge the patch. There were
> some people making unsubstantiated claims that it didn't scale, but
> the available benchmarks showed that it scaled perfectly across the
> parameters tested.

What is the testing status of this?

Have any real-life applications been converted?

Does it require libaio changes to test?

>
> +int async_poll(struct kiocb *iocb, int events);
> +

growl. Please don't put function prototypes in .c files. It defeats
typechecking. I've moved this to aio.h.

> +int async_poll(struct kiocb *iocb, int events)
> +{
> + unsigned int mask;
> + struct async_poll_iocb *apiocb = kiocb_to_apiocb(iocb);
> +
> + /* Fast path */
> + if (iocb->ki_filp->f_op && iocb->ki_filp->f_op->poll) {
> + mask = iocb->ki_filp->f_op->poll(iocb->ki_filp, NULL);
> + mask &= events | POLLERR | POLLHUP;
> + if (mask & events)
> + return events;
> + }
> +
> + init_poll_funcptr(&apiocb->pt, async_poll_queue_proc);
> + apiocb->armed = &apiocb;
> + apiocb->outofmem = 0;
> + apiocb->events = events;
> + apiocb->ehead = NULL;
> +
> + iocb->ki_users++;

There is no locking around this modification of ->ki_users. Is this
correct?

> + wmb();

Barriers always need comments explaining why they are there.

> +
> + mask = DEFAULT_POLLMASK;
> + if (iocb->ki_filp->f_op && iocb->ki_filp->f_op->poll)
> + mask = iocb->ki_filp->f_op->poll(iocb->ki_filp, &apiocb->pt);
> + mask &= events | POLLERR | POLLHUP;
> + if (mask && xchg(&apiocb->armed, NULL)) {
> + async_poll_freewait(apiocb, NULL);
> + aio_complete(iocb, mask, 0);
> + }
> + if (unlikely(apiocb->outofmem) && xchg(&apiocb->armed, NULL)) {
> + async_poll_freewait(apiocb, NULL);
> + aio_put_req(iocb);
> + aio_put_req(iocb);

Is the double-put intentional?