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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,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 DF2E3C43381 for ; Tue, 19 Mar 2019 14:43:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA3C020850 for ; Tue, 19 Mar 2019 14:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727887AbfCSOnI (ORCPT ); Tue, 19 Mar 2019 10:43:08 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52694 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727879AbfCSOnH (ORCPT ); Tue, 19 Mar 2019 10:43:07 -0400 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 6E1ED1650; Tue, 19 Mar 2019 07:43:06 -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 E41C03F71A; Tue, 19 Mar 2019 07:43:03 -0700 (PDT) Date: Tue, 19 Mar 2019 14:43:01 +0000 From: Catalin Marinas To: Nicolin Chen Cc: hch@lst.de, robin.murphy@arm.com, vdumpa@nvidia.com, will.deacon@arm.com, chris@zankel.net, jcmvbkbc@gmail.com, joro@8bytes.org, dwmw2@infradead.org, m.szyprowski@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, iommu@lists.linux-foundation.org, jonathanh@nvidia.com Subject: Re: [PATCH v2 RFC/RFT] dma-contiguous: Get normal pages for single-page allocations Message-ID: <20190319144301.GG59586@arrakis.emea.arm.com> References: <20190305183202.16216-1-nicoleotsuka@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190305183202.16216-1-nicoleotsuka@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. -- Catalin