Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3027827pxk; Mon, 7 Sep 2020 00:30:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTBnVi5N08p+SuU/6RSDNDUefYhnq6NJvilSAlr50dV9A6TyAfLt47x5CbDWmIFj2kfH2r X-Received: by 2002:aa7:d3d6:: with SMTP id o22mr21133795edr.293.1599463817885; Mon, 07 Sep 2020 00:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599463817; cv=none; d=google.com; s=arc-20160816; b=q8MbPF5GhBsW+p7t1fsCGyu77T6A+DQdV/wnmBed8wn8nIm5472q0rVcDVXo/y2S+G FAyVY4wpZaNKKONC2YfFmk0ZQuj2fJoS2NK/o0HoeIAfJNBYiJ9FG/ekHmj6SUP3X7Uk y/IKHwwdS11IiFm3CBMuvp+JBm1dIJzxRe/8OGFp3P60XW0ccpVjuxmfKtSC5lgy4eOf k+VASkEzo5Ih36dDpRUql2/e9gL4NmIDjDhXM2CJZ+D7tqP4rxbBHDEH8AInhggu2RNI 96MxuuXSjQ19wWtHIgNvCdirGGGlHs3HAb/8bmCNs6pyyj1dA0wyadhnxKhzgBk4ZxCU aYxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=l7ciBld6AMpJhITYlzqq3D+DR/fqOekaZVmfLwLjbY4=; b=Cq/k7ciwe6mFtXBXe5m8ap2Kj94U9qjUlCBON6Fn85nmfc0Nz6v0PBuadO6+Ox6B2l u0U1xhf69JXmhgbAXmosh0aYz+ykRmJjTEH/XgAn/rTSzAr7k2QoKmoSCW9M9KBEPZhe ldGgpFpVWACDgTVlhGBf7P05OCiNLeSXr6Ypq1yJlsoOiNaSjDYCPthGZjuYYXTXAeFV Wa+OrWZUikrRJp33BaVobe50/Vg5qkNIICQ/JvE8H/Myh14Yq5A94Fy9sUFhNReuzj4/ +85BgqgfmgIVRDcFNTXLvAiBBwgVV9Vc/oeKDM2GKhHNEb+Y5yTZjnfkB3GHmJ5cJyFi bRhg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si8693675eds.384.2020.09.07.00.29.55; Mon, 07 Sep 2020 00:30:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgIGH3P (ORCPT + 99 others); Mon, 7 Sep 2020 03:29:15 -0400 Received: from verein.lst.de ([213.95.11.211]:47986 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726741AbgIGH3P (ORCPT ); Mon, 7 Sep 2020 03:29:15 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id A348F68BEB; Mon, 7 Sep 2020 09:29:12 +0200 (CEST) Date: Mon, 7 Sep 2020 09:29:12 +0200 From: Christoph Hellwig To: Leon Romanovsky Cc: Christoph Hellwig , Doug Ledford , Jason Gunthorpe , Maor Gottlieb , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH rdma-next 1/4] lib/scatterlist: Refactor sg_alloc_table_from_pages Message-ID: <20200907072912.GA19875@lst.de> References: <20200903121853.1145976-1-leon@kernel.org> <20200903155434.1153934-1-leon@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903155434.1153934-1-leon@kernel.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 03, 2020 at 06:54:34PM +0300, Leon Romanovsky wrote: > From: Maor Gottlieb > > Currently, sg_alloc_table_from_pages doesn't support dynamic chaining of > SG entries. Therefore it requires from user to allocate all the pages in > advance and hold them in a large buffer. Such a buffer consumes a lot of > temporary memory in HPC systems which do a very large memory registration. > > The next patches introduce API for dynamically allocation from pages and > it requires us to do the following: > * Extract the code to alloc_from_pages_common. > * Change the build of the table to iterate on the chunks and not on the > SGEs. It will allow dynamic allocation of more SGEs. > > Since sg_alloc_table_from_pages allocate exactly the number of chunks, > therefore chunks are equal to the number of SG entries. Given how few users __sg_alloc_table_from_pages has, what about just switching it to your desired calling conventions without another helper?