On Mon, May 13, 2019 at 08:37:45AM +0200, Christoph Hellwig wrote:
> Currently ll_merge_requests_fn, unlike all other merge functions,
> reduces nr_phys_segments by one if the last segment of the previous,
> and the first segment of the next segement are contigous. While this
> seems like a nice solution to avoid building smaller than possible
Some workloads need this optimization, please see 729204ef49ec00b
("block: relax check on sg gap"):
If the last bvec of the 1st bio and the 1st bvec of the next
bio are physically contigious, and the latter can be merged
to last segment of the 1st bio, we should think they don't
violate sg gap(or virt boundary) limit.
Both Vitaly and Dexuan reported lots of unmergeable small bios
are observed when running mkfs on Hyper-V virtual storage, and
performance becomes quite low. This patch fixes that performance
issue.
It can be observed that thousands of 512byte bios in one request when
running mkfs related workloads.
> requests it causes a mismatch between the segments actually present
> in the request and those iterated over by the bvec iterators, including
> __rq_for_each_bio. This could cause overwrites of too small kmalloc
Request based drivers usually shouldn't iterate bio any more.
Thanks,
Ming