On Sun, Mar 21, 2021 at 08:54:31PM +0800, Zhu Yanjun wrote: > On Sun, Mar 21, 2021 at 8:07 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > > > On Sun, Mar 21, 2021 at 04:06:07PM +0800, Zhu Yanjun wrote: > > > > > > You are reporting 4k pages, if max_segment is larger than 4k there is > > > > > > no such thing as "too big" > > > > > > > > > > > > I assume it is "too small" because of some maths overflow. > > > > > > > > > > 459 while (n_pages && page_to_pfn(pages[0]) == paddr) { > > > > > 460 if (prv->length + PAGE_SIZE > > > > > > max_segment) <--it max_segment is big, n_pages is zero. > > > > > > > > What does n_pages have to do with max_segment? > > > > > > With the following snippet > > > " > > > struct ib_umem *region; > > > region = ib_umem_get(pd->device, start, len, access); > > > > > > page_size = ib_umem_find_best_pgsz(region, > > > SZ_4K | SZ_2M | SZ_1G, > > > virt); > > > " > > > > Can you please stop posting random bits of code that do nothing to > > answer the question? > > > > > IMHO, you can reproduce this problem in your local host. > > > > Uh, no, you need to communicate effectively or stop posting please. > > can you read the following link again > > https://patchwork.kernel.org/project/linux-rdma/patch/CAD=hENeqTTmpS5V+G646V0QvJFLVSd3Sq11ffQFcDXU-OSsQEg@xxxxxxxxxxxxxx/#24031643 > > In this link, I explained it in details. No, this is all nonsense > Since the max_segment is very big, so normally the prv->length + > PAGE_SIZE is less than max_segment, it will loop over and over again, > until n_pages is zero, And each iteration increases prv->length += PAGE_SIZE; n_pages--; Where prv is the last sgl entry, so decreasing n_pages cannot also yield a 4k sgl entry like you are reporting. You get 4k sgl entries if max_segment is *too small* not too big! Jason