From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E289C43381 for ; Fri, 22 Mar 2019 10:57:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57C4121900 for ; Fri, 22 Mar 2019 10:57:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gcq7uiuA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57C4121900 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8pwzuTCiC7hYNlVJRsXUCOMLjUhNRI6jFTi1H8706G0=; b=gcq7uiuA6Ht1a5 1V0mXBrM6YQvP4keonxqBGraFLkIHo2K1FR64Nt+4avBOMu0is4gN89KER2E9CjZbX0a5IsoSh/dq Z6xzc9wwt9HI+YatTnPgTWQP3Kg286Hirs48qr0yCYR9/dNNISzbBoVEnK06osyCCMCgiP2R3w32u GJzXbXszdsFxCvhYTPHAlRJTkOpOO74JHzPrYQh1rDL7v/NbDsjn+fk8mVNWlxDRNLzGK2PJF+KLo 4NGrx05HrjSaP+2KHhc/gMIVVTZUOOxy+13k5f/XSJc7wiSo3MqF6jcsEKkPJS+ek3GOLRaETazag 7leMN+3osFpTCKqUwZtA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7HrX-0002xD-78; Fri, 22 Mar 2019 10:57:23 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7HrT-0002ws-Ne for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2019 10:57:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0F220374; Fri, 22 Mar 2019 03:57:18 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85D8C3F575; Fri, 22 Mar 2019 03:57:15 -0700 (PDT) Date: Fri, 22 Mar 2019 10:57:13 +0000 From: Catalin Marinas To: Nicolin Chen Subject: Re: [PATCH v2 RFC/RFT] dma-contiguous: Get normal pages for single-page allocations Message-ID: <20190322105712.GB13384@arrakis.emea.arm.com> References: <20190305183202.16216-1-nicoleotsuka@gmail.com> <20190319144301.GG59586@arrakis.emea.arm.com> <20190321233248.GA6941@Asurada-Nvidia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190321233248.GA6941@Asurada-Nvidia> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190322_035719_786807_F2D40AA9 X-CRM114-Status: GOOD ( 21.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chris@zankel.net, linux-xtensa@linux-xtensa.org, dwmw2@infradead.org, joro@8bytes.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jonathanh@nvidia.com, jcmvbkbc@gmail.com, robin.murphy@arm.com, hch@lst.de, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Nicolin, On Thu, Mar 21, 2019 at 04:32:49PM -0700, Nicolin Chen wrote: > On Tue, Mar 19, 2019 at 02:43:01PM +0000, Catalin Marinas wrote: > > On Tue, Mar 05, 2019 at 10:32:02AM -0800, Nicolin Chen wrote: > > > The addresses within a single page are always contiguous, so it's > > > not so necessary to always allocate one single page from CMA area. > > > Since the CMA area has a limited predefined size of space, it may > > > run out of space in heavy use cases, where there might be quite a > > > lot CMA pages being allocated for single pages. > > > > > > However, there is also a concern that a device might care where a > > > page comes from -- it might expect the page from CMA area and act > > > differently if the page doesn't. > > > > > > This patch tries to get normal pages for single-page allocations > > > unless the device has its own CMA area. This would save resources > > > from the CMA area for more CMA allocations. And it'd also reduce > > > CMA fragmentations resulted from trivial allocations. > > > > This is not sufficient. Some architectures/platforms declare limits on > > the CMA range so that DMA is possible with all expected devices. For > > example, on arm64 we keep the CMA in the lower 4GB of the address range, > > though with this patch you only covered the iommu ops allocation. > > I will follow the way of v1 by adding alloc_page()/free_page() > function to those callers who don't have fallback allocations. > In this way, archs may use different callbacks to alloc pages. > > > Do you have any numbers to back this up? You don't seem to address > > dma_direct_alloc() either but, as I said above, it's not trivial since > > some platforms expect certain physical range for DMA allocations. > > What's the dma_direct_alloc() here about? Mind elaborating? I just did a grep for dma_alloc_from_contiguous() in the 5.1-rc1 kernel and came up with __dma_direct_alloc_pages(). Should your patch cover this as well? -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel