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 478E5C433FE for ; Wed, 22 Dec 2021 12:37:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 823FB6B0072; Wed, 22 Dec 2021 07:37:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D2DB6B0073; Wed, 22 Dec 2021 07:37:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 673946B0074; Wed, 22 Dec 2021 07:37:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 54D406B0072 for ; Wed, 22 Dec 2021 07:37:10 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 046C683C3B for ; Wed, 22 Dec 2021 12:37:10 +0000 (UTC) X-FDA: 78945380220.25.2B7D1E6 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf23.hostedemail.com (Postfix) with ESMTP id 7DEA3140038 for ; Wed, 22 Dec 2021 12:37:02 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id r5so2010332pgi.6 for ; Wed, 22 Dec 2021 04:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UZz7xhafkkHpJkMgl/kac5c4UCSL804TVcwmmdEcK/0=; b=nsK2TtW3n6e1+xlg1RZyMo4ycIQFl2Xn4YC2120yajzQ6jPjoaIwA6gZz1sGETLPUL Rfa/LfPmrvEWU4Ei7szxx6trUEnm0qqv0dd2AiuW7yC9Q8Kmj65hZzxMmeDD3bHL/spD 7R1e6dtfBRTi2XLI4rk8HxD+FiGZii7cJPWWjtz94MCdYnZAByH7nd70yU8pbinerVFe czLvEyE+RXSPw54P41GoQuj/8IBRLGfLgE/5wHW3f/xNdt8UjnFKxL/mLLdLjPFFyQdm 00IoO5rCraGZGFjUndcF10Su7RbUd0SQh9K+J3+3MKToFMJm3/n6GSWfk3qCY+FDHmMQ CjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UZz7xhafkkHpJkMgl/kac5c4UCSL804TVcwmmdEcK/0=; b=FN/eu6LeHRdnWusXlAX+h92/ghz5plRdQABovHY6v6/hU5H5pxwKPky8tKA5oru3ER RW+FBbu0bhP0MLpx73btyGrMVLQbqAmLFRW/vKE0tNciqcbl40JIYkFvVe62q1l323ry b0VV//fyqdqJcIrN41Xq0BomlFBKW9r/9Sf+/KiNzYIfGq4qPXkhi/zWbbiAOTFHlmHv FJHIC9BgykKF+G4pV2JMMxcL+okF6LMqu+UgzCgz0UABBVAgn8lp7rOweXryisS2bEYN KX1xTiz6MGUls16F29UVasLuc7B8uyxZ7KV4C9y24nlEDreIceortlfDvfmelLr5c7VR gKaQ== X-Gm-Message-State: AOAM530Cbo3kBNstD2URB8gnzEyVeRJ9BsaeMRw67j9CZ+DyIBCN7chI d1kIAXsQlGpqalUjvgXjz2M= X-Google-Smtp-Source: ABdhPJywzhxYDDrq26wikSanWRvBdbTroGbSbcvCsRISQViIDfeWIm5m9pfq2nL//FWIWUPg7CAIoQ== X-Received: by 2002:a63:6dc8:: with SMTP id i191mr333146pgc.34.1640176628671; Wed, 22 Dec 2021 04:37:08 -0800 (PST) Received: from ip-172-31-30-232.ap-northeast-1.compute.internal (ec2-18-181-137-102.ap-northeast-1.compute.amazonaws.com. [18.181.137.102]) by smtp.gmail.com with ESMTPSA id om10sm2616130pjb.13.2021.12.22.04.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 04:37:08 -0800 (PST) Date: Wed, 22 Dec 2021 12:37:03 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Hellwig Cc: Baoquan He , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, 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: References: <20211213122712.23805-1-bhe@redhat.com> <20211213122712.23805-6-bhe@redhat.com> <20211213134319.GA997240@odroid> <20211214053253.GB2216@MiWiFi-R3L-srv> <20211221085623.GA7733@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211221085623.GA7733@lst.de> X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7DEA3140038 X-Stat-Signature: 5dt19gcqjytq7m43ep4rrrh4cqksuwrx Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nsK2TtW3; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.169 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1640176622-11315 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: Hello Christoph. On Tue, Dec 21, 2021 at 09:56:23AM +0100, Christoph Hellwig wrote: > 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. Oh I misunderstood this. Underlying physical address of vmalloc()-allocated memory can be mapped using DMA API, and it needs to be setup as scatterlist because the allocated memory is not physically continuous. Right? BTW, looking at the API I think the scsi case can be converted to use dma_alloc_pages(). but driver requires 512 bytes of buffer and the API supports allocating by at least page size. It's not a big problem as it allocates a single buffer but in other cases maybe not. Can't we use dma pool for non-coherent pages? Thanks, Hyeonggon. > > 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.