On Tue, Sep 01, 2020 at 09:43:29PM -0300, Jason Gunthorpe wrote: > It is possible for a single SGL to span an aligned boundary, eg if the SGL > is > > 61440 -> 90112 > > Then the length is 28672, which currently limits the block size to > 32k. With a 32k page size the two covering blocks will be: > > 32768->65536 and 65536->98304 > > However, the correct answer is a 128K block size which will span the whole > 28672 bytes in a single block. > > Instead of limiting based on length figure out which high IOVA bits don't > change between the start and end addresses. That is the highest useful > page size. > > Fixes: 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR") > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/infiniband/core/umem.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>