From: chrubis-AlSwsSmVLrQ@public.gmane.org
To: Jeff Moyer <jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 4/4] io_setup.2: clarify nr_events
Date: Mon, 22 Apr 2013 16:07:03 +0200 [thread overview]
Message-ID: <20130422140703.GA4845@rei> (raw)
In-Reply-To: <x497gjuoeal.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
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-AlSwsSmVLrQ@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-04-22 14:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 19:36 [PATCH 0/4] updates for the io_*.2 man pages Jeff Moyer
[not found] ` <1365104218-26042-1-git-send-email-jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-04-04 19:36 ` [PATCH 1/4] io_cancel.2: fix up the description Jeff Moyer
[not found] ` <1365104218-26042-2-git-send-email-jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-04-08 10:04 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAki66jwQvKGLDWRomG0-s29EP34MZCoU=eUjHnQsn3x8wA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-10 11:14 ` chrubis-AlSwsSmVLrQ
[not found] ` <20130410111422.GB1376-WQn62CkN1y0S3W1tAdPHOtBPR1lH4CV8@public.gmane.org>
2013-04-10 13:59 ` Jeff Moyer
[not found] ` <x49ppy2jxkm.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2013-04-11 9:08 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkg0wv=XO7UwpnafE98HNMZrA=jZh4fN+m7UmijwUaroJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 10:14 ` chrubis-AlSwsSmVLrQ
[not found] ` <20130411101430.GA1325-WQn62CkN1y0S3W1tAdPHOtBPR1lH4CV8@public.gmane.org>
2013-04-11 13:52 ` Jeff Moyer
2013-04-04 19:36 ` [PATCH 2/4] io_destroy.2: " Jeff Moyer
[not found] ` <1365104218-26042-3-git-send-email-jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-04-08 10:02 ` Michael Kerrisk (man-pages)
2013-04-04 19:36 ` [PATCH 3/4] io_getevents.2: timeout will not be updated Jeff Moyer
[not found] ` <1365104218-26042-4-git-send-email-jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-04-08 9:53 ` Michael Kerrisk (man-pages)
2013-04-04 19:36 ` [PATCH 4/4] io_setup.2: clarify nr_events Jeff Moyer
[not found] ` <1365104218-26042-5-git-send-email-jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-04-08 9:58 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkhGAiDETDcQSFhYNCqJgbRH20SVHfV4=osW9=xAr1Zk4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-22 13:08 ` chrubis-AlSwsSmVLrQ
2013-05-14 14:47 ` chrubis-AlSwsSmVLrQ
2013-04-22 13:30 ` chrubis-AlSwsSmVLrQ
2013-04-22 14:01 ` Jeff Moyer
[not found] ` <x497gjuoeal.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2013-04-22 14:07 ` chrubis-AlSwsSmVLrQ [this message]
2013-04-22 14:10 ` Jeff Moyer
[not found] ` <x4938uiodvg.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2013-04-22 14:21 ` chrubis-AlSwsSmVLrQ
2013-04-22 14:54 ` chrubis-AlSwsSmVLrQ
2013-04-22 15:49 ` Jeff Moyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130422140703.GA4845@rei \
--to=chrubis-alswssmvlrq@public.gmane.org \
--cc=jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox