From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hugh Dickins Date: Sun, 19 Mar 2023 22:23:36 -0700 (PDT) Subject: [Cluster-devel] [PATCH 5/7] shmem: open code the page cache lookup in shmem_get_folio_gfp In-Reply-To: <20230307143410.28031-6-hch@lst.de> References: <20230307143410.28031-1-hch@lst.de> <20230307143410.28031-6-hch@lst.de> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tue, 7 Mar 2023, Christoph Hellwig wrote: > Use the very low level filemap_get_entry helper to look up the > entry in the xarray, and then: > > - don't bother locking the folio if only doing a userfault notification > - open code locking the page and checking for truncation in a related > code block > > This will allow to eventually remove the FGP_ENTRY flag. > > Signed-off-by: Christoph Hellwig Acked-by: Hugh Dickins but Andrew, please fold in this small improvement to its comment: [PATCH] shmem: open code the page cache lookup in shmem_get_folio_gfp fix Adjust the new comment line: shmem folio may have been swapped out. Signed-off-by: Hugh Dickins --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1905,7 +1905,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, if (folio) { folio_lock(folio); - /* Has the page been truncated? */ + /* Has the folio been truncated or swapped out? */ if (unlikely(folio->mapping != mapping)) { folio_unlock(folio); folio_put(folio);