On Wed, Jul 29, 2026 at 12:45:47PM +0100, Pavel Begunkov wrote:
It was exposed in early version as I was passing a [{dma,len}, ...] array, but we moved from that. Maybe I should put the minimum segment size in the map structure, and (possibly over) split using that for now? Keith had this chunk in his patches:
int offset = offset_in_page(bio->bi_iter.bi_bvec_done);nsegs = ALIGN(bio->bi_iter.bi_size + offset, PAGE_SIZE) >>PAGE_SHIFT;if (bio->bi_iter.bi_size > max_bytes) {bytes = max_bytes;nsegs = (bytes + offset) >> PAGE_SHIFT;} else if (nsegs > lim->max_segments) {nsegs = lim->max_segments;bytes = PAGE_SIZE * nsegs - offset;} else {*segs = nsegs;return NULL;}
This seems very pessimistic, especially for the case of the registration only having a single segment, which I'd expect to be fairly common due to P2P bar mappings, huge pages or IOMMU coalescing. So at very least we'd want to special case that, but in an idea world the caller would be required to provide a useful nr_segments for the I/O.