[Intel-gfx] [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents
Maor Gottlieb
maorg at nvidia.com
Wed Aug 25 04:59:27 UTC 2021
On 8/24/2021 10:12 PM, Jason Gunthorpe wrote:
> On Tue, Aug 24, 2021 at 05:25:30PM +0300, Maor Gottlieb wrote:
>> @@ -514,11 +531,13 @@ struct scatterlist *sg_alloc_append_table_from_pages(struct sg_table *sgt,
>> offset = 0;
>> cur_page = j;
>> }
>> - sgt->nents += added_nents;
>> + sgt_append->sgt.nents += added_nents;
>> + sgt_append->sgt.orig_nents = sgt_append->sgt.nents;
>> + sgt_append->prv = s;
> Why is nents being touched here?
>
> Shouldn't it just be
>
> sgt_append->sgt.orig_nents += added_nents;
> sgt_append->prv = s;
>
> ?
In general yes, but all the sg_alloc_* functions update both orig_nents
and nents (to same value). May be drivers that pass nents instead of
orig_nents to dma_map_sg* (like umem did before this patch set). So I
prefer to set it here as well, also not to break
sg_alloc_table_from_pages_segment which use the same path. This kind of
change could be done very carefully next cycle for all sg_alloc_*.
>
> Let me know I can fix it
>
> Jason
More information about the Intel-gfx
mailing list