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.2 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 75BA1C43381 for ; Thu, 21 Mar 2019 23:33:02 +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 3EDC721900 for ; Thu, 21 Mar 2019 23:33:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HXD7tSsN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k37tqebX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EDC721900 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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=Z6G8XFfLU0aY8L2hTNkQQsyYSkaaugeNaKoNTZAf9q0=; b=HXD7tSsNYbVpKT u9uGq45tSUC80qNfdoMNR/1UFEgWEa6/Re6iT7/fuP2XAI/LjoU2+Tpw9qkB180kdKrPOLtH9R+vD 3xLroU8EaTLewVXoA3uHqWs/QwzxBfyLCvir3/4cFDUDE766AYxMYK9t4iFNIpz0yVvz+ZEJNF5m5 XOcNM/nRmw7PHwHUZFW20005f8l0K1H9rZR3Z3tAU8UKO4URDC//aZcAdrYM1zbBJXAx+6kiSoPXP B/qLAk1TEvviE5QWXTnFj1iO1K53v3E1KoJBSvoVMtQ4+fD77uj+57iEtyHarExWYaspS1XYjblLW qMA7I24eKA4FsuHtLzwQ==; 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 1h77BB-0004JP-Dk; Thu, 21 Mar 2019 23:32:57 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h77B9-0004J1-62 for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2019 23:32:56 +0000 Received: by mail-pf1-x443.google.com with SMTP id t21so182718pfe.2 for ; Thu, 21 Mar 2019 16:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GEocbLjjDTKTljdWOMhW+1JP4PUi5ZACKOFHF1tRnIs=; b=k37tqebXfM1ddWWXMbk/NieuKojSrULiHf+wTL8c6OHAhh5GpQfn2WjHbp/TdSltyw wZ42ZRcM5Q2/TMUfJzz4f5hmIMOikMB1tBFekviHHXQqtHFDdtV1/mod/3KaNl0Lj/Ar yDdCTM/Qkwgtdz8Oc1MvejwxYRzzMEJOW5Zi8RDWxN2PMN2rbndXCoj9A0lWn1OV4Ywi 0l4qqNl3IE1+gAUrKhUGNlskzmKx/nIeDo+aqcZ2mXrIWbqxvSSRvM8tpDiD7GWdcf4B MB7L3UCw38Xc1S/QQuVKj3WENIJlbrZdhQt9tFE6mGbF902fiAekZrXvDQ6DoxxhAzF0 mdaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GEocbLjjDTKTljdWOMhW+1JP4PUi5ZACKOFHF1tRnIs=; b=qy/sgFNZc5//7McPwGY5AiG5NnD9VkBuQWZZwEU20oxC+iHxjQ5VCcnNyFZfZLPM0Z Cc13ystUflL/CdLJ3znHNODrOLdIyQbC/seexbRtciVglQj+HdRS5vK0uu/0bL/igmdo E0VR8KW9Ogq44O+fBT/xckpQW+E4Fs/XVoA0LUiQ3KOQXAqQJsH21TdbVJD9+8cZEdzY 0hDKeoHxVPIz1XzixOht+8S5Ux1FN3M3Vv6UG/a14JSMoZalboel3SPO2k/JRvh1wRWr 8/PTV3iomT1x8W3A1/DNbW6tMKu1gnTIu9+Pcn3fGau+ixCvr3et+EZR8lPakpy+jFV2 6mxA== X-Gm-Message-State: APjAAAXvbgvwanXq5mvu2smP9j4CPC9+A4XAnBv32AfOK4fUk/zl4HDT Yzy54iweKrT8mhv2T8k2ghQ= X-Google-Smtp-Source: APXvYqwuNdqA1gmUED9ljwJawDm6D4Kj41V/VZoFSFqM7mJPNQTnReo0MaGF0gRsUXP2NBN8MSF01w== X-Received: by 2002:a62:2a97:: with SMTP id q145mr6187680pfq.22.1553211174050; Thu, 21 Mar 2019 16:32:54 -0700 (PDT) Received: from Asurada-Nvidia (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id w18sm10219623pfg.75.2019.03.21.16.32.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 16:32:53 -0700 (PDT) Date: Thu, 21 Mar 2019 16:32:49 -0700 From: Nicolin Chen To: Catalin Marinas Subject: Re: [PATCH v2 RFC/RFT] dma-contiguous: Get normal pages for single-page allocations Message-ID: <20190321233248.GA6941@Asurada-Nvidia> References: <20190305183202.16216-1-nicoleotsuka@gmail.com> <20190319144301.GG59586@arrakis.emea.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190319144301.GG59586@arrakis.emea.arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190321_163255_260056_CD3929C8 X-CRM114-Status: GOOD ( 19.25 ) 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 Catalin, Thank you for the review. And I realized that the free() path is missing too. 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? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel