Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4502303ybv; Mon, 17 Feb 2020 00:04:41 -0800 (PST) X-Google-Smtp-Source: APXvYqw2Efkc+JgcBboaf479oaAkoVxCXeAwbCZJNlZu6qm1bSU1DWOagso4CAKsuwJ7l8ignaA/ X-Received: by 2002:aca:4a84:: with SMTP id x126mr8700433oia.99.1581926681238; Mon, 17 Feb 2020 00:04:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581926681; cv=none; d=google.com; s=arc-20160816; b=ye38r1PjKTo1bHwtsylEIgo4CllussHfnfd1yBap0byLzj+u+T/4ZByhifsKvqvR5W Ssq56/1a7XqwNzdbaoxfeExx7Cf9iQBXvC3xUPTHRPE/PpS0SCS3ZwxbrP2IMHs51GpR X6adWGXg66GSKMAWkGDDGRUfCgj3oEgpkwqICZrJrjnxqxUjuHnOPAsBhJTnrmxDthKw aKUI2EtvsrhcBQ0d9uQmFKmrTx5U1XFB7lwZJi3bBbAO/xpwdybyJtD0pjzvjepE2o4o 3/93eK0FF3++AhUQABwLLwtwOp+l/Cc2iKMopjhLWzlLhKBP4v1sGjxuGFAp17Uo8G7u lDow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8P83UJrtckadRvtNN0mURBLMcfies6xy/6xqO0urT5o=; b=sRS8MXsLO5Y3zY2NCTEw8MDxV+g3z4hJkz0QHMDEwRd7H+QtjSKRI+98SHP+1RrAA5 ixSKUl6X2rg8CrFRA0fHgC/frEVqaHtnSNPSGLPu0T59TrXc9QrZ/34go+Y/i5pCKbzC /6pEnT7qTx6g5UqFowdg7MhXQg0raf4cG92Bwcxir79WfCeQFuPsv9CpafpSRqA6290A GZ7N5Ab32epdfQPTl5kHXwzm9riRUSEt54/v+cm97jOXlzZvsqQv+y2W5nRsqrVqfZmV O2M40LloiiIbpsRWqzMJ/ydzYCx0ioI9x+kw1CPCuTFBmJWVZDd/QRDxlgOg8NBznS5W nbpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pR6w489j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si6933452oti.306.2020.02.17.00.04.28; Mon, 17 Feb 2020 00:04:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=pR6w489j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbgBQIDk (ORCPT + 99 others); Mon, 17 Feb 2020 03:03:40 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44036 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbgBQIDk (ORCPT ); Mon, 17 Feb 2020 03:03:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8P83UJrtckadRvtNN0mURBLMcfies6xy/6xqO0urT5o=; b=pR6w489jwpWzTZkIt7TS4VRUAT 0iSpnLjSF3rARv6DXNVyvB6Aa8BpTMgegD65WXsrGIk3psu+zT3RutRyP/8rP6glPkf75451XC85e tLs9mTddvqYGiw6MYBcVAD0UGxELfFiWqXvOfSTq4oupG2xHkvrz9mFUFAYRhLSB5WgAsbWb/oWB6 i0egE74ary8QC3yIaRA3wZ+eLHzFiNwnA5km1BSyqkaKvltZLF0MLQvQIO7gS0drwvPPv8qqiomGC CFI1U5+529P/6m+E+khKN6UFr+0beNGTLcNBxKVtKBIqHZO7D5UqpsmZV1QimSIrlgUPEz7J+mdlR XjylMqfA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j3bNT-0005bX-51; Mon, 17 Feb 2020 08:03:39 +0000 Date: Mon, 17 Feb 2020 00:03:39 -0800 From: Christoph Hellwig To: "Isaac J. Manjarres" Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Liam Mark , joro@8bytes.org, pratikp@codeaurora.org, kernel-team@android.com Subject: Re: [RFC PATCH] iommu/iova: Add a best-fit algorithm Message-ID: <20200217080339.GC10342@infradead.org> References: <1581721602-17010-1-git-send-email-isaacm@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1581721602-17010-1-git-send-email-isaacm@codeaurora.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 14, 2020 at 03:06:42PM -0800, Isaac J. Manjarres wrote: > From: Liam Mark > > Using the best-fit algorithm, instead of the first-fit > algorithm, may reduce fragmentation when allocating > IOVAs. As we like to say in standards groups: may also implies may not. Please provide numbers showing that this helps, and preferably and explanation how it doesn't hurt as well. > + * Should be called prior to using dma-apis. > + */ > +int iommu_dma_enable_best_fit_algo(struct device *dev) > +{ > + struct iommu_domain *domain; > + struct iova_domain *iovad; > + > + domain = iommu_get_domain_for_dev(dev); > + if (!domain || !domain->iova_cookie) > + return -EINVAL; > > + iovad = &((struct iommu_dma_cookie *)domain->iova_cookie)->iovad; > + iovad->best_fit = true; > return 0; > } > +EXPORT_SYMBOL(iommu_dma_enable_best_fit_algo); Who is going to call this? Patches adding exports always need a user that goes along with the export. Also drivers have no business calling directly into dma-iommu.