lkml.org 
[lkml]   [2021]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH rdma-next v4 2/3] lib/scatterlist: Fix wrong update of orig_nents
From
Date

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

\
 
 \ /
  Last update: 2021-08-25 07:01    [W:0.059 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site