On Tue, Oct 09, 2012 at 09:20:46AM -0700, Chuck Silvers wrote: > > [...] > > I wondered that myself. I think multiple of pagesize is probably okay, > > but -- IIRC -- I couldn't convince myself we'd always do the right thing > > with the residual. Try it? > > the underlying mechanism used by the UVM read ahead code (pgo_get / > VOP_GETPAGES) > can handle any number of pages, not just power-of-2-sized groups of pages. > there's no reason for the read ahead code to limit itself that way.
The reason was the computation of the tranfer length: bytelen = ((off + chunksize) & -(off_t)chunksize) - off; but as off and chunksize are both a multiple of PAGE_SIZE, using chunksize as bytelen is just fine. I just removed this and use chunksize as the size of the read-ahead, and it seems to work fine. Now, iostat -x shows that sequential read of a large file (either with cat or dd bs=1m) is done in 32k transfers at the disk level. So I guess something is not working properly here ... -- Manuel Bouyer <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --