From mboxrd@z Thu Jan 1 00:00:00 1970 From: chrubis-AlSwsSmVLrQ@public.gmane.org Subject: Re: [PATCH 4/4] io_setup.2: clarify nr_events Date: Mon, 22 Apr 2013 16:54:07 +0200 Message-ID: <20130422145406.GC4845@rei> References: <1365104218-26042-1-git-send-email-jmoyer@redhat.com> <1365104218-26042-5-git-send-email-jmoyer@redhat.com> <20130422133039.GB3975@rei> <20130422140703.GA4845@rei> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-man-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jeff Moyer Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: linux-man@vger.kernel.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. > > I don't think so, since it's an implementation detail and subject to > change. What about this wording: The io_setup() system call creates an asynchronous I/O context suitable for concurrently processing nr_events operations. -- 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