On Sat, Oct 28, 2023 at 09:15:42PM +0000, Daniel Gomez wrote: > @@ -856,16 +856,16 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping, > pgoff_t start, pgoff_t end) > { > XA_STATE(xas, &mapping->i_pages, start); > - struct page *page; > + struct folio *folio; > unsigned long swapped = 0; > unsigned long max = end - 1; > > rcu_read_lock(); > - xas_for_each(&xas, page, max) { > - if (xas_retry(&xas, page)) > + xas_for_each(&xas, folio, max) { > + if (xas_retry(&xas, folio)) > continue; > - if (xa_is_value(page)) > - swapped++; > + if (xa_is_value(folio)) > + swapped += folio_nr_pages(folio); ... you can't call folio_nr_pages() if xa_is_value().