On Fri, Apr 05, 2024 at 02:20:28PM -0700, Vishal Moola wrote: > On Wed, Apr 03, 2024 at 06:18:35PM +0100, Matthew Wilcox (Oracle) wrote: > > - page = find_lock_page(mapping, index); > > - if (unlikely(page == NULL)) { > > + folio = filemap_lock_folio(mapping, index); > > + if (unlikely(folio == NULL)) { > > filemap_lock_folio() can return an ERR_PTR(), find_lock_page() handles > it internally. Argh. I keep forgetting that when doing conversions. Thanks. Andrew, if you could attach this fix ... (the unlikely() is embedded in IS_ERR() so no need to keep it here) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 6a96a85de56b..89e2624fb3ff 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1865,7 +1865,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, /* drain lru cache to help isolate_lru_page() */ lru_add_drain(); folio = filemap_lock_folio(mapping, index); - if (unlikely(folio == NULL)) { + if (IS_ERR(folio)) { result = SCAN_FAIL; goto xa_unlocked; }