Re: [PATCH v2] io_uring: reduce latency by reissueing the operation

From: Olivier Langlois
Date: Sun Jun 20 2021 - 17:05:54 EST


On Sun, 2021-06-20 at 20:56 +0100, Pavel Begunkov wrote:
> On 6/20/21 8:05 PM, Olivier Langlois wrote:
> >
> >  
> > -static bool io_arm_poll_handler(struct io_kiocb *req)
> > +#define IO_ARM_POLL_OK    0
> > +#define IO_ARM_POLL_ERR   1
> > +#define IO_ARM_POLL_READY 2
>
> Please add a new line here. Can even be moved somewhere
> to the top, but it's a matter of taste.

If you let me decide, I prefer to let them close to where they are
used. There is so much data definitions in the heading section that I
feel like putting very minor implementation details to it might
overwhelm newcomers instead of helping them to grasp the big picture.

but I will add an extra space as you request
>
> Also, how about to rename it to apoll? io_uring internal
> rw/send/recv polling is often abbreviated as such around
> io_uring.c
> IO_APOLL_OK and so on.

no problem. I will.
>
> > +static int io_arm_poll_handler(struct io_kiocb *req)
> >  {
> >         const struct io_op_def *def = &io_op_defs[req->opcode];
> >         struct io_ring_ctx *ctx = req->ctx;
> > @@ -5153,22 +5156,22 @@ static bool io_arm_poll_handler(struct
> > io_kiocb *req)
> >         int rw;
> >  
> >         if (!req->file || !file_can_poll(req->file))
> > -               return false;
> > +               return IO_ARM_POLL_ERR;
>
> It's not really an error. Maybe IO_APOLL_ABORTED or so?

Ok.