Since the tail pointer in aio_ring structure never wrap ring size more than once, so a simple compare is sufficient to wrap the index around. This avoid a more expensive mod operation. Signed-off-by: Ken Chen --- linux-2.6.11/fs/aio.c.orig 2005-03-24 15:37:27.000000000 -0800 +++ linux-2.6.11/fs/aio.c 2005-03-24 16:05:24.000000000 -0800 @@ -984,7 +984,8 @@ int fastcall aio_complete(struct kiocb * tail = info->tail; event = aio_ring_event(info, tail, KM_IRQ0); - tail = (tail + 1) % info->nr; + if (++tail >= info->nr) + tail = 0; event->obj = (u64)(unsigned long)iocb->ki_obj.user; event->data = iocb->ki_user_data;