Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2699301pxk; Sun, 4 Oct 2020 08:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydsq3f8P7UpWlle9qdkk8PXPcezDmEoLJXoZdN4xL5UfD+ph97kqvna58WxBNpMyHEGtBW X-Received: by 2002:a05:6402:6d0:: with SMTP id n16mr11846811edy.133.1601826314418; Sun, 04 Oct 2020 08:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601826314; cv=none; d=google.com; s=arc-20160816; b=eEsipYHhGN55Xwad/JUzAM1L9TMfuI4aY0C4BMnCLLJAmw0F2tAjLzM1kovwlnoj0s wkhc194sGA1tnd8x0wXrTqZzzj+OXRX4dA8O0smgxC3wnz749bUNucR096ZIqJ6K4k9Y YB7tsOhVqXD0z726HKmoDzCqiiqpPWdnPO+opi9tWfrCU8wzElUx7Z/34FvKXPGVGNAk hZO5NQeFpITFzhL0Fn9v4gcsT9HasHLdJQm4ce95xhxxMosTz9AiEyKNWgSi2pSqyiSY M5eSB0wBUeqRVcQSractp9F5QfY1wIHW3m22b9wtX/NxL0kqPYVn3BbARQ6kg5aYc9dw 6v8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mcrMBIeV+uxg+MP4bLOi36VqTaxhtNmxWb10pDbtu7U=; b=bK/dmF3v5wjyQ1Wi5LCKlQKVVNXDEXIdIB5n9eaeX5SUjhfqofpJc9037bMflpLfG8 82y/6Thrao7KGf9EYr1rhvgPN8SAjvM31eQA4h5WF1AtXTX9kaWXn2mgyt7Gv+aM+kf5 TvCqM6ftsIDb0YZGl7ufcNRfOqOx3+2LUApSeUCb+jT760endbIBaMWzfQzFXSolKLLv LW8PLYjb9VJfx0jiNWTlmWebW7+JKXRMQQeD3FuGe3N2qeor04eCE95JMU63Jc/ozdJ1 A8eRiEJx5b+k6p1ueAYs6KtBkUM/cezhmxQW1PuB2ovUPYQHHmkjKSKfzFnVx9WMCuSV dEhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H+BZCGU5; 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 ch9si4231edb.172.2020.10.04.08.44.52; Sun, 04 Oct 2020 08:45: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=H+BZCGU5; 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 S1725868AbgJDPns (ORCPT + 99 others); Sun, 4 Oct 2020 11:43:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:57334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgJDPnr (ORCPT ); Sun, 4 Oct 2020 11:43:47 -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 5CCDD206C1; Sun, 4 Oct 2020 15:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601826227; bh=7kcJRhYO8i8a8NUKH4udVbO1HkOL8u4Fb50Z6E77+LI=; h=From:To:Cc:Subject:Date:From; b=H+BZCGU5zKMw0E4CuPMwdOlui4sRFV1k6qd+Zztd0AqnYH/Uuu2wXnkFzbKmDPqUu oDmIYyWjMJMq+Nw0734D5+yiw04lOPVHCfc+9fooZPZZOOacYE4aBXO7i4rNT0a9Q7 /AaNSm6AsTTkWa+263mOggATwZ5UYuk6iNawyyic= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , Christoph Hellwig , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Maor Gottlieb , Rodrigo Vivi , Roland Scheidegger , Tvrtko Ursulin , VMware Graphics Subject: [PATCH rdma-next v5 0/4] Dynamicaly allocate SG table from the pages Date: Sun, 4 Oct 2020 18:43:36 +0300 Message-Id: <20201004154340.1080481-1-leon@kernel.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky Changelog: v5: * Use sg_init_table to allocate table and avoid changes is __sg_alloc_table * Fix offset issue v4: https://lore.kernel.org/lkml/20200927064647.3106737-1-leon@kernel.org * Fixed formatting in first patch. * Added fix (clear tmp_netnts) in first patch to fix i915 failure. * Added test patches v3: https://lore.kernel.org/linux-rdma/20200922083958.2150803-1-leon@kernel.org/ * Squashed Christopher's suggestion to avoid introduced new API, but extend existing one. v2: https://lore.kernel.org/linux-rdma/20200916140726.839377-1-leon@kernel.org * Fixed indentations and comments * Deleted sg_alloc_next() * Squashed lib/scatterlist patches into one v1: https://lore.kernel.org/lkml/20200910134259.1304543-1-leon@kernel.org * Changed _sg_chain to be __sg_chain * Added dependency on ARCH_NO_SG_CHAIN * Removed struct sg_append v0: * https://lore.kernel.org/lkml/20200903121853.1145976-1-leon@kernel.org -------------------------------------------------------------------------- From Maor: This series extends __sg_alloc_table_from_pages to allow chaining of new pages to already initialized SG table. This allows for the 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 second 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 (2): lib/scatterlist: Add support in dynamic allocation of SG table from pages RDMA/umem: Move to allocate SG table from pages Tvrtko Ursulin (2): tools/testing/scatterlist: Rejuvenate bit-rotten test tools/testing/scatterlist: Show errors in human readable form drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 15 ++- drivers/infiniband/core/umem.c | 94 ++------------- include/linux/scatterlist.h | 38 +++--- lib/scatterlist.c | 125 ++++++++++++++++---- tools/testing/scatterlist/Makefile | 3 +- tools/testing/scatterlist/linux/mm.h | 35 ++++++ tools/testing/scatterlist/main.c | 53 ++++++--- 8 files changed, 225 insertions(+), 150 deletions(-) -- 2.26.2