public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Maor Gottlieb <maorg@nvidia.com>,
	Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
	Yishai Hadas <yishaih@nvidia.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>
Subject: Re: [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of orig_nents
Date: Wed, 30 Jun 2021 10:02:11 +0300	[thread overview]
Message-ID: <YNwW83ZpXZSSPDfM@unreal> (raw)
In-Reply-To: <YNwQLV87aBdclTYe@infradead.org>

On Wed, Jun 30, 2021 at 07:33:17AM +0100, Christoph Hellwig wrote:
> On Wed, Jun 30, 2021 at 09:29:51AM +0300, Leon Romanovsky wrote:
> > On Wed, Jun 30, 2021 at 06:59:11AM +0100, Christoph Hellwig wrote:
> > > On Tue, Jun 29, 2021 at 11:40:01AM +0300, Leon Romanovsky wrote:
> > > > 2. Add a new field total_nents to reflect the total number of entries
> > > >    in the table. This is required for the release flow (sg_free_table).
> > > >    This filed should be used internally only by scatterlist.
> > > 
> > > No, please don't bloat the common structure.
> > 
> > Somehow we need to store that total_nents value and our internal
> > proposal was to wrap sg_table with another private structure that is
> > visible in lib/scatterlist.c only.
> > 
> > Something like that:
> > struct sg_table_private {
> >   struct sg_table table;
> >   unsigned int total_nents;
> > };
> > 
> > But it looks awkward.
> 
> Well, the important point is that we only need it for the new
> way of collapsing, appending allocations.  We should not burden
> it on all other users.

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.

Thanks

  reply	other threads:[~2021-06-30  7:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  8:40 [PATCH rdma-next v1 0/2] SG fix together with update to RDMA umem Leon Romanovsky
2021-06-29  8:40 ` [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of orig_nents Leon Romanovsky
2021-06-30  5:59   ` Christoph Hellwig
2021-06-30  6:29     ` Leon Romanovsky
2021-06-30  6:33       ` Christoph Hellwig
2021-06-30  7:02         ` Leon Romanovsky [this message]
2021-06-30  7:16           ` Christoph Hellwig
2021-06-30  9:14             ` Maor Gottlieb
2021-06-30 11:12   ` Marek Szyprowski
2021-06-30 11:16     ` Leon Romanovsky
2021-06-30 17:44     ` Thierry Reding
2021-06-30 17:49       ` Leon Romanovsky
2021-06-29  8:40 ` [PATCH rdma-next v1 2/2] RDMA: Use dma_map_sgtable for map umem pages Leon Romanovsky
2021-06-29 23:08 ` [PATCH rdma-next v1 0/2] SG fix together with update to RDMA umem Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNwW83ZpXZSSPDfM@unreal \
    --to=leon@kernel.org \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=hch@infradead.org \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    --cc=yishaih@nvidia.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox