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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4F4AC433EF for ; Tue, 21 Dec 2021 08:56:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D83A6B0078; Tue, 21 Dec 2021 03:56:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 387D46B007B; Tue, 21 Dec 2021 03:56:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 276376B007D; Tue, 21 Dec 2021 03:56:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 18CEA6B0078 for ; Tue, 21 Dec 2021 03:56:28 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C243E86E71 for ; Tue, 21 Dec 2021 08:56:27 +0000 (UTC) X-FDA: 78941195214.09.14383BA Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf09.hostedemail.com (Postfix) with ESMTP id A7843140020 for ; Tue, 21 Dec 2021 08:56:22 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id A0D3868AFE; Tue, 21 Dec 2021 09:56:23 +0100 (CET) Date: Tue, 21 Dec 2021 09:56:23 +0100 From: Christoph Hellwig To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Baoquan He , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, hch@lst.de, cl@linux.com, John.p.donnelly@oracle.com, kexec@lists.infradead.org, stable@vger.kernel.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka Subject: Re: [PATCH v3 5/5] mm/slub: do not create dma-kmalloc if no managed pages in DMA zone Message-ID: <20211221085623.GA7733@lst.de> References: <20211213122712.23805-1-bhe@redhat.com> <20211213122712.23805-6-bhe@redhat.com> <20211213134319.GA997240@odroid> <20211214053253.GB2216@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=none (imf09.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none X-Rspamd-Queue-Id: A7843140020 X-Stat-Signature: n6zq9mobimaxm7ww8q7n9q479dmgqwui X-Rspamd-Server: rspam04 X-HE-Tag: 1640076982-533137 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Dec 17, 2021 at 11:38:27AM +0000, Hyeonggon Yoo wrote: > My understanding is any buffer requested from kmalloc (without > GFP_DMA/DMA32) can be used by device driver because it allocates > continuous physical memory. It doesn't mean that buffer allocated > with kmalloc is free of addressing limitation. Yes. > > the addressing limitation comes from the capability of device, not > allocation size. if you allocate memory using alloc_pages() or kmalloc(), > the device has same limitation. and vmalloc can't be used for > devices because they have no MMU. vmalloc can be used as well, it just needs to be setup as a scatterlist and needs a little lover for DMA challenged platforms with the invalidate_kernel_vmap_range and flush_kernel_vmap_range helpers. > But we can map memory outside DMA zone into bounce buffer (which resides > in DMA zone) using DMA API. Yes, although in a few specific cases the bounce buffer could also come from somewhere else.