[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2134e949-0569-c495-cb0b-f0324c5920df@nvidia.com>
Date: Wed, 30 Jun 2021 12:14:04 +0300
From: Maor Gottlieb <maorg@...dia.com>
To: Christoph Hellwig <hch@...radead.org>,
Leon Romanovsky <leon@...nel.org>
CC: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
<linux-kernel@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
"Mike Marciniszyn" <mike.marciniszyn@...nelisnetworks.com>,
Yishai Hadas <yishaih@...dia.com>,
Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of
orig_nents
On 6/30/2021 10:16 AM, Christoph Hellwig wrote:
> On Wed, Jun 30, 2021 at 10:02:11AM +0300, Leon Romanovsky wrote:
>> Another possible solution is to change __sg_alloc_table()/__sg_alloc_table_from_pages
>> to return total_nents and expect from the users to store it internally and pass
>> it later to the __sg_free_table().
>>
>> Something like that.
> Yes, that sounds pretty reasonable.
OK. So we have two options
1. Add another argument (output) to __sg_alloc_table_from_pages and
__sg_free_table.
The thing is that __sg_free_table gets free_fn as argument while
__sg_alloc_table_from_pages doesn't get alloc function. Users will pass
NULL as free_fn and scatterlist internally will use sg_kfree.
2. Have dedicated functions to the appending allocations -
sg_alloc_table_from_pages_append and sg_free_table_append. With this
approach users that use __sg_alloc_table_from_pages not for appending
allocation don't need to maintain the new argument.
Christoph, what do you prefer? do you see a better option?
Powered by blists - more mailing lists