Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp725627ybb; Wed, 8 Apr 2020 08:44:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLpg1hULd3DgXTicGov0vomPhS1wd9DaIa832uvjIJD7QLAtgMHnMUR61gkqboKHnwx9eLA X-Received: by 2002:a4a:dbc7:: with SMTP id t7mr763897oou.57.1586360672178; Wed, 08 Apr 2020 08:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586360672; cv=none; d=google.com; s=arc-20160816; b=LWxlgcNOqoV/1SVlx0Qs4y0FZt22Mz73r7bBHaFdcFpkHM6Ks8TNJq587F8QjUAQhV 19x6xK64M6G2U7jNf/dn/AiFGa/JWXfEzyL4qbJD/wom2GJ9yBKPCDbqEHkhLQ5YFPdl UxRKwY8Pg2PT98M2C3m64/dGJQ3W+1AxKPVbi7EtLTdSp4Lkhx2zghXGkb1tMEF3oxJz t1nB9ONNaALltVUavjjdMDbC3xPz0ey4D22YZGYxE0MbPIHo+scmFaEnJe418Rl4v0Rl ccTjjOxi3AY0UtNo9LAziBEG0bFAV6Yh4w3LZbfx5MhGZoI76Syp1ToSXMT6px6+XBmc x7Ig== 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; bh=Hm9mr27lVlhLhtLX20K1wom3yyE/DTZfLRtV9OTro8A=; b=i1kH4ZpSl9RWvyLTVw0IrNNcLh0y2xAGGKuMKAQBen2d9BSzyim5Rl4XujjRXsNrn8 xCL9Sg5jFuEVXjqjpNVs79pQGCeVUZVy/5uxKAbQw+u7QG0XLePE5E4n4AJXUz7HEMwG GJAhM6IbkyiSuTqBmuJhyteiSVSc7xYkXmdZ47004pd2R2mfYpOKuYScBA1HJqO20heo 3I4oA9j5E5BzPlF9GWmEFo8o3tTgBnr9ZEpv8bLJuvSRXaoVwJFgR6bnO4+SIDrvO3Gy Pb5DIvOYsDyzrwzJ1qGzdHUzh7Th8Gc6mTfkw4dqTlrsc2aXN+irtLIkZ+zYiPPl3KRV ztsg== ARC-Authentication-Results: i=1; mx.google.com; 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 i5si2678608otp.103.2020.04.08.08.44.10; Wed, 08 Apr 2020 08:44:32 -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; 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 S1729342AbgDHPm2 (ORCPT + 99 others); Wed, 8 Apr 2020 11:42:28 -0400 Received: from verein.lst.de ([213.95.11.211]:42929 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727933AbgDHPm2 (ORCPT ); Wed, 8 Apr 2020 11:42:28 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 313AE68C4E; Wed, 8 Apr 2020 17:42:26 +0200 (CEST) Date: Wed, 8 Apr 2020 17:42:25 +0200 From: Christoph Hellwig To: Hillf Danton Cc: Christoph Hellwig , Andrew Morton , linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/28] dma-mapping: use vmap insted of reimplementing it Message-ID: <20200408154225.GA28676@lst.de> References: <20200408115926.1467567-1-hch@lst.de> <20200408131736.9532-1-hdanton@sina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408131736.9532-1-hdanton@sina.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 08, 2020 at 09:17:36PM +0800, Hillf Danton wrote: > > @@ -62,24 +42,20 @@ void *dma_common_pages_remap(struct page **pages, size_t size, > > void *dma_common_contiguous_remap(struct page *page, size_t size, > > pgprot_t prot, const void *caller) > > { > > - int i; > > + int count = size >> PAGE_SHIFT; > > struct page **pages; > > - struct vm_struct *area; > > + void *vaddr; > > + int i; > > > > - pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL); > > + pages = kmalloc_array(count, sizeof(struct page *), GFP_KERNEL); > > Is it making sense to vmalloc pages as long as array size is bigger than > PAGE_SIZE? Maybe, maybe not. But it certainly doesn't fit this series.