LKML Archive on
 help / color / Atom feed
From: Leon Romanovsky <>
To: iChristoph Hellwig <>,
	Doug Ledford <>,
	Jason Gunthorpe <>
Cc: Leon Romanovsky <>,,,
	Maor Gottlieb <>
Subject: [PATCH rdma-next v1 0/4] scatterlist: add sg_alloc_table_append function
Date: Thu, 10 Sep 2020 16:42:55 +0300
Message-ID: <> (raw)

From: Leon Romanovsky <>

 * Changed _sg_chain to be __sg_chain
 * Added dependency on ARCH_NO_SG_CHAIN
 * Removed struct sg_append

From Maor:

This series adds a new constructor for a scatter gather table. Like
sg_alloc_table_from_pages function, this function merges all contiguous
chunks of the pages a into single scatter gather entry.

In contrast to sg_alloc_table_from_pages, the new API allows chaining of
new pages to already initialized SG table.

This allows drivers to utilize the optimization of merging contiguous
pages without a need to pre allocate all the pages and hold them in
a very large temporary buffer prior to the call to SG table initialization.

The first two patches refactor the code of sg_alloc_table_from_pages
in order to have code sharing and add sg_alloc_next function to allow
dynamic allocation of more entries in the SG table.

The third patch introduces the new API.

The last patch changes the Infiniband driver to use the new API. It
removes duplicate functionality from the code and benefits the
optimization of allocating dynamic SG table from pages.

In huge pages system of 2MB page size, without this change, the SG table
would contain x512 SG entries.
E.g. for 100GB memory registration:

             Number of entries      Size
    Before        26214400          600.0MB
    After            51200            1.2MB


Maor Gottlieb (4):
  lib/scatterlist: Refactor sg_alloc_table_from_pages
  lib/scatterlist: Add support in dynamically allocation of SG entries
  lib/scatterlist: Add support in dynamic allocation of SG table from
  RDMA/umem: Move to allocate SG table from pages

 drivers/infiniband/Kconfig     |   1 +
 drivers/infiniband/core/umem.c |  90 ++--------
 include/linux/scatterlist.h    |  35 ++--
 lib/scatterlist.c              | 292 +++++++++++++++++++++++++--------
 4 files changed, 255 insertions(+), 163 deletions(-)


             reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 13:42 Leon Romanovsky [this message]
2020-09-10 13:42 ` [PATCH rdma-next v1 1/4] lib/scatterlist: Refactor sg_alloc_table_from_pages Leon Romanovsky
2020-09-15 16:16   ` Christoph Hellwig
2020-09-16  7:17     ` Leon Romanovsky
2020-09-10 13:42 ` [PATCH rdma-next v1 2/4] lib/scatterlist: Add support in dynamically allocation of SG entries Leon Romanovsky
2020-09-15 16:19   ` Christoph Hellwig
2020-09-16  7:18     ` Leon Romanovsky
2020-09-10 13:42 ` [PATCH rdma-next v1 3/4] lib/scatterlist: Add support in dynamic allocation of SG table from pages Leon Romanovsky
2020-09-15 16:23   ` Christoph Hellwig
2020-09-16  7:19     ` Leon Romanovsky
2020-09-10 13:42 ` [PATCH rdma-next v1 4/4] RDMA/umem: Move to allocate " Leon Romanovsky

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone