Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11127993ybi; Thu, 25 Jul 2019 10:27:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlYH6pLZk3bMNgOpPPQrUVMQ+A5u8JrDFLcQjy5xc8fK10bC2jEYqSMLZkXIiusQMu6u8z X-Received: by 2002:a17:902:6a87:: with SMTP id n7mr90590276plk.336.1564075622840; Thu, 25 Jul 2019 10:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564075622; cv=none; d=google.com; s=arc-20160816; b=mhrF6OYyUSLVQE1BtgDGpHZmV0LyR+/KInxr658iBDHtVuTLinjCJVLvrKpEuO/JbU l3Jswy/9QzGDXPSrN+2PRa2mpO6xM/ExBF86bZtKnojY50eLAJvIvNEDYivKLpydHdjS sErEyiENw7OmhgSSX7PrbBX13nP2ubydVpCCwem6fj2Olk6CtBlUF7jVpwpPwSqNmVi5 GDmwe/NXC4cUZg2WlevdDHValRUFBvjWEs4znPftgLAwwuxMvz4H2eF1A1VTdQ7K8dlV rJy+xin09uNwZLyUD44dwCOy5eGC+MiNbkJT/EhNsPI0pBAlym0ispFUhVL2am+R3H3n h7CA== 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:dkim-signature; bh=emJzk9odpy1wnlUGcXdIzUFv1SXJfSlgageYxVB9ttk=; b=Tt2OFaXX5oIqJFKg8y425PWDmJKtFC9ibkGSuHDKC/Y54SF7I8WvUaLx/WFO9qbpwf DdSWuyQA+qplhvP1vRqbA7WMAUf3n4S7HoRBjTQYULk0KDZi95O761xW/ymLguoUPper ocewuabEQnDJ1SFUOxTRkw5PLDSkdllYDdH2DhoU6hgZEe7qdvf/V/zOQvFf4wz8ce8W Big4T6g5yOM54YXKOD5Qis7tw0mWtkq+lXQ6FWzB+CGMyM5VYdwLeHRYreuS7+tLEiJp 4pl2wVmNYkYEIwePuK2IB/WAo2M4JkLMdoimK7L/49/YAtg8dSW+5/W2GE/dsn66yNlb piHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="bZAG/LpG"; 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 ch18si16730262plb.76.2019.07.25.10.26.48; Thu, 25 Jul 2019 10:27:02 -0700 (PDT) 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="bZAG/LpG"; 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 S2388859AbfGYMp0 (ORCPT + 99 others); Thu, 25 Jul 2019 08:45:26 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38776 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387824AbfGYMp0 (ORCPT ); Thu, 25 Jul 2019 08:45:26 -0400 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=emJzk9odpy1wnlUGcXdIzUFv1SXJfSlgageYxVB9ttk=; b=bZAG/LpGP+NKh/MRi5Jp7hN47 vKXsFv3Bu6+0/pdl2vCAYrsqSPKfBRywv94yzvNfiMY6g6uX3kw6mM4o81ToVJDZv/pFkaZyTjZUu I/Q4jl9/olAhVQ9D0Uz9XdfucTea6rY9EjI0Rav6U1Z8bDIq/oFRdysjtDIUa1gSMKpEIapfAQH5T xW/kxfgeS724msQMeqnj/mTwjNZJPOtWgplC5gYmbPAXeDTWrS7FPmcHpweGDlN3XnlwABxrrvIla Yf3iJxbBuVoBI6Eq//Lv8a0s3zzjq8GefmXitCKCK9SQMB+SEAlBTstJ7hKELthxI2NxL8b687Y05 kCM2zAFxA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hqd7c-0008GX-Lj; Thu, 25 Jul 2019 12:45:24 +0000 Date: Thu, 25 Jul 2019 05:45:24 -0700 From: Christoph Hellwig To: Benjamin Gaignard Cc: Christoph Hellwig , John Stultz , lkml , Laura Abbott , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Xu YiPing , "Chenfeng (puck)" , butao , "Xiaqing (A)" , Yudongbin , Chenbo Feng , Alistair Strachan , dri-devel Subject: Re: [PATCH v6 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps Message-ID: <20190725124524.GB20286@infradead.org> References: <20190624194908.121273-1-john.stultz@linaro.org> <20190624194908.121273-5-john.stultz@linaro.org> <20190718100840.GB19666@infradead.org> <20190724065958.GC16225@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) 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 Wed, Jul 24, 2019 at 10:08:54AM +0200, Benjamin Gaignard wrote: > CMA has made possible to get large regions of memories and to give some > priority on device allocating pages on it. I don't think that possible > with system > heap so I suggest to keep CMA heap if we want to be able to port a maximum > of applications on dma-buf-heap. Yes, CMA is a way to better allocate contigous regions, but it isn't the only way to do that. So at least for the system default CMA area it really should be a helper for the system heap, especially given that CMA is an optional feature and we can do high order contigous allocations using alloc_pages as well. Something like: if (!require_contigous && order > 0) { for (i = 0; i < nr_pages; i++) page[i] = alloc_page(); goto done; } else if (order > 0) page = cma_alloc(); if (page) goto done; } page = alloc_pages(order);