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

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

 



Hi!
> >> 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.
> 
> I don't think so, since it's an implementation detail and subject to
> change.

That is for sure, but I would like to advice the user of the interface
that nr_events is the maximum that could be expected to portably work.

-- 
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