Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp612372pxk; Thu, 3 Sep 2020 08:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfn+iHqaAN7AVKOIKkh+EbicON2+6VuXMz91mBL6DxlndBps64KdETwHnLbJBUVI8+B1jl X-Received: by 2002:a17:906:a3d0:: with SMTP id ca16mr2568253ejb.455.1599146054243; Thu, 03 Sep 2020 08:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599146054; cv=none; d=google.com; s=arc-20160816; b=CbephpPaAS5pW/o3/ZoXGb9lODqM1QBUnK4pK4732bVi/GAizh0W8mKichQKVrt4JZ wWzrfrqyN3gEfDWxQBvWW49hTdsUaio6Rcr1AIyyTPG2VfpLU36mkEd1IPS2TTHaBzw2 eB2KEYZin5knGO3d1nLx8Ysjw0ZgvawMvS6+6emuJK9WGW8sKmtAHUHeBxd93iRvPabE 0F2opEImbMjwUHd/5rsVmRfUhgNCNTZwI3QQXsFm5rolInVaqwiTs+YOy5zTv0KapjXY kkIlD3r33uIRTCF6AeiwWGb28mWxwUYsUf52lkXO/0PUmzU9qKb8guMlN+8Vdz4InLm4 CLHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=peS+Itli8s4ZGPILFdmXbUGwsYJkvo8zxknnE1TZs/c=; b=tQBm4GCSAHSX/E3x0VLeaIBpjCbv5a8k919sS4J881vJfhr/WBZRKUxs5pj7t3BhJo vhCRGQGGwgaC6J2k5YUa1qrH4E6xdk3YYIP7WussE8WmvDi9K4/GipB30+zdbQhKW7Vs tytv9ghCtB5FXoQFrh2yXLQdvXVccXeXVbfmpPXxdoRMsJjgm7+/pv+aqiJE78Yey40k ccljt1cKbwjwpgY75/cPUUffrBrFvXPDSnXwx8Wc4qTj1M+H0wxNF0GGq1JkdvRnD1JG 7shtYRlDPlSyreG5tmZoiJu91kha7EicUDg0fr2kZTS/WXSx2oypOcYvFduWs8tamGeI i1og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fwb9EwN5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si1864584edx.591.2020.09.03.08.13.51; Thu, 03 Sep 2020 08:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fwb9EwN5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729495AbgICPM2 (ORCPT + 99 others); Thu, 3 Sep 2020 11:12:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:44498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbgICMTH (ORCPT ); Thu, 3 Sep 2020 08:19:07 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD5F520678; Thu, 3 Sep 2020 12:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599135539; bh=wCOPLXlmHEGYn5CATKOPZbt394577U8KrrxC4c41eGA=; h=From:To:Cc:Subject:Date:From; b=Fwb9EwN5Nzx6MGZlSGn75Jjszvk/sKs+LWYm2mNw0CKoIQX3PcEW2/ZEUsiuQHZqD BZUaqwPL+2JIfkDHpiZZb5mzQUws6OhsDURmHS7gI79QytxmvWn6Zv22AmHJDf4JjS FG1+i/GKoOZ2fYyn5RGLBq/7MNgDBZn++tI9tCMc= From: Leon Romanovsky To: Christoph Hellwig , Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Maor Gottlieb Subject: [PATCH rdma-next 0/4] scatterlist: add sg_alloc_table_append function Date: Thu, 3 Sep 2020 15:18:49 +0300 Message-Id: <20200903121853.1145976-1-leon@kernel.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky 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 Thanks 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 pages RDMA/umem: Move to allocate SG table from pages drivers/infiniband/core/umem.c | 93 ++-------- include/linux/scatterlist.h | 39 +++-- lib/scatterlist.c | 302 +++++++++++++++++++++++++-------- 3 files changed, 271 insertions(+), 163 deletions(-) -- 2.26.2