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 5D403C433EF for ; Thu, 31 Mar 2022 08:53:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D92746B0072; Thu, 31 Mar 2022 04:53:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D424C6B0074; Thu, 31 Mar 2022 04:53:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE2506B0075; Thu, 31 Mar 2022 04:53:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id AA69E6B0072 for ; Thu, 31 Mar 2022 04:53:47 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6C555A5D30 for ; Thu, 31 Mar 2022 08:53:47 +0000 (UTC) X-FDA: 79304068494.25.CA9D46D Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf18.hostedemail.com (Postfix) with ESMTP id BAE1D1C0014 for ; Thu, 31 Mar 2022 08:53:46 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 2E81268AA6; Thu, 31 Mar 2022 10:53:42 +0200 (CEST) Date: Thu, 31 Mar 2022 10:53:41 +0200 From: Christoph Hellwig To: Alex Sierra Cc: jgg@nvidia.com, david@redhat.com, Felix.Kuehling@amd.com, 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, hch@lst.de, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org, akpm@linux-foundation.org Subject: Re: [PATCH v2 1/3] mm: add vm_normal_lru_pages for LRU handled pages only Message-ID: <20220331085341.GA22102@lst.de> References: <20220330212537.12186-1-alex.sierra@amd.com> <20220330212537.12186-2-alex.sierra@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330212537.12186-2-alex.sierra@amd.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Stat-Signature: cbxdwg11ghsrtbqpb938if8x6okuhdjg Authentication-Results: imf18.hostedemail.com; dkim=none; spf=none (imf18.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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BAE1D1C0014 X-HE-Tag: 1648716826-633435 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: > - page = vm_normal_page(vma, addr, pte); > + page = vm_normal_lru_page(vma, addr, pte); Why can't this deal with ZONE_DEVICE pages? It certainly has nothing do with a LRU I think. In fact being able to have stats that count say the number of device pages here would probably be useful at some point. In general I find the vm_normal_lru_page vs vm_normal_page API highly confusing. An explicit check for zone device pages in the dozen or so spots that care has a much better documentation value, especially if accompanied by comments where it isn't entirely obvious. > page = follow_page(vma, addr, > - FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE); > + FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE | FOLL_LRU); Overly long line here. > +/* > + * NOTE: Technically this should goto check_pfn label. However, page->_mapcount > + * is never incremented for device pages that are mmap through DAX mechanism > + * using pmem driver mounted into ext4 filesystem. When these pages are unmap, > + * zap_pte_range is called and vm_normal_page return a valid page with > + * page_mapcount() = 0, before page_remove_rmap is called. > + */ Please properly indent comments. > + * zone, as long as the pte's are present and vm_normal_lru_page() succeeds. These > * pages also get pinned. Another overly long line here.