Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1149807pxb; Thu, 19 Aug 2021 22:07:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYiQy4sqc24SsHtLJv7hSuWTMpYKnqGMqI+60gQmsgjIoWW1PgXwcsMyl0qveEzstTu2Lm X-Received: by 2002:a17:906:c251:: with SMTP id bl17mr19567614ejb.219.1629436037347; Thu, 19 Aug 2021 22:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629436037; cv=none; d=google.com; s=arc-20160816; b=rWZyqHYdmBo/ClzTfUQIkJu52O57owU5h3/8vUU4+zl2SNJ81kDjP32b1+RS8ovcR6 c70+E+sjGM53tVAZTli43iNN1oWLr5Cb7Tx96zPUgZgalvntz/57U0xIxrMKV/yLgCY5 D4YFhawSPPpD2N8UQfzmCwbivw5PUqnGF0osRK1a3mE8W0ElitW8W06xmE0L2yUFINyH MVO/ufxzp11wS5szOoaB7EFYnmWdPmRIdtLLQkGYCbVSKKwEsjT4YzbFfRH4V5hWA9s4 UC6zp4C+mlpc+qMaj7t12SptEY3AS62gHvwaH+f7JannKuO6FYA8tzhhVj07/R8ftK5C LZIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=KvYK3/YrfZAoZ37d5latfdrSmb2DW8jcpdZqsptW/No=; b=s5t+wgYsOL91rhl1SS55sVsoCQewhWVoaM7mW0JGW+5RqBojc0hLzV46ui1/0t882j J9BXgHM/FgiuU7eHlL7bclWy0EzIYv2V0Xfb5EH1GLRpe1xZOw8ebNB/RyBwDPDaYTp8 3S1dFtBgSadb9Ie4mNpHgopBY0gJ0Bj8WQ7H1A0LSbhaduF8pBYTouWYRzUSc9J0wiY1 yUawAdAmcu+kpixMF6ML1Onpp7Xp7/wimnMvV2q/GPUa56jPTUULE+SX8uzM1+uLYcVF VGqiJ5KJFPkTazprWbwpVthtv6AJ/63zJAu2jZg5Mp+J3s9NX7MJeccsADwaZXCH++HM AO7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si5402829edy.599.2021.08.19.22.06.50; Thu, 19 Aug 2021 22:07:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbhHTFFq (ORCPT + 99 others); Fri, 20 Aug 2021 01:05:46 -0400 Received: from verein.lst.de ([213.95.11.211]:39719 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbhHTFFq (ORCPT ); Fri, 20 Aug 2021 01:05:46 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id F19846736F; Fri, 20 Aug 2021 07:05:04 +0200 (CEST) Date: Fri, 20 Aug 2021 07:05:04 +0200 From: Christoph Hellwig To: Felix Kuehling Cc: Christoph Hellwig , Alex Sierra , akpm@linux-foundation.org, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, jgg@nvidia.com, jglisse@redhat.com, Roger Pau Monne , Dan Williams , Boris Ostrovsky Subject: Re: [PATCH v6 08/13] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages Message-ID: <20210820050504.GB27083@lst.de> References: <20210813063150.2938-1-alex.sierra@amd.com> <20210813063150.2938-9-alex.sierra@amd.com> <20210815154047.GC32384@lst.de> <7a55366f-bd65-7ab9-be9e-3bfd3aea3ea1@amd.com> <20210817055031.GC4895@lst.de> 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) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Aug 17, 2021 at 11:44:54AM -0400, Felix Kuehling wrote: > >> That's a good catch. Existing drivers shouldn't need a page_free > >> callback if they didn't have one before. That means we need to add a > >> NULL-pointer check in free_device_page. > > Also the other state clearing (__ClearPageWaiters/mem_cgroup_uncharge/ > > ->mapping = NULL). > > > > In many ways this seems like you want to bring back the DEVICE_PUBLIC > > pgmap type that was removed a while ago due to the lack of users > > instead of overloading the generic type. > > I think so. I'm not clear about how DEVICE_PUBLIC differed from what > DEVICE_GENERIC is today. As I understand it, DEVICE_PUBLIC was removed > because it was unused and also known to be broken in some ways. > DEVICE_GENERIC seemed close enough to what we need, other than not being > supported in the migration helpers. > > Would you see benefit in re-introducing DEVICE_PUBLIC as a distinct > memory type from DEVICE_GENERIC? What would be the benefits of making > that distinction? The old DEVICE_PUBLIC mostly different in that it allowed the page to be returned from vm_normal_page, which I think was horribly buggy. But the point is not to bring back these old semantics. The idea is to be able to differeniate between your new coherent on-device memory and the existing DEVICE_GENERIC. That is call the code in free_devmap_managed_page that is currently only used for device private pages also for your new public device pages without affecting the devdax and xen use cases.