Re: [PATCH 4/4] io_setup.2: clarify nr_events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!
> > Looking carefully at the io_setup.2 man page it says:
> >
> > ...
> > The  io_setup() system call creates an asynchronous I/O context capable
> > of concurrently processing at least nr_events.
> > ...
> >                             ^
> > 			    The 'at least' caught my eye, as it is it
> > 			    may suggest that the nr_events is low limit
> > 			    on the number of events.
> >
> >
> > Wouldn't be 'at most' more appropriate here? Quick look in the kernel
> > sources suggest that it allocates buffers for nr_events elements.
> >
> > Or am I missing something?
> 
> When the kernel ring buffer is setup, it is created in page size
> chunks, and nr_events is rounded up:
> 
>         /* Compensate for the ring buffer's head/tail overlap entry */
>         nr_events += 2; /* 1 is required, 2 for good luck */
> 
>         size = sizeof(struct aio_ring);
>         size += sizeof(struct io_event) * nr_events;
>         nr_pages = (size + PAGE_SIZE-1) >> PAGE_SHIFT;
> 
>         if (nr_pages < 0)
>                 return -EINVAL;
> 
>         nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);

Ah, now it all makes sense.

And I'm thinking if it is worth of adding more clear description.

-- 
Cyril Hrubis
chrubis@xxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux