Re: [RFC 3/8] shmem: account for high order folios
From: Matthew Wilcox
Date: Fri Apr 21 2023 - 18:47:15 EST
On Fri, Apr 21, 2023 at 02:43:55PM -0700, Luis Chamberlain wrote:
> - if (xa_is_value(page))
> - swapped++;
> + if (xa_is_value(folio))
> + swapped+=(folio_nr_pages(folio));
swapped += folio_nr_pages(folio);
> if (xa_is_value(folio)) {
> + long swaps_freed = 0;
> if (unfalloc)
> continue;
> - nr_swaps_freed += !shmem_free_swap(mapping,
> - indices[i], folio);
> + swaps_freed = folio_nr_pages(folio);
Why initialise it to 0 when you're about to set it to folio_nr_pages()?
> + if (!shmem_free_swap(mapping, indices[i], folio)) {
> + if (swaps_freed > 1)
> + pr_warn("swaps freed > 1 -- %lu\n", swaps_freed);
Debug code that escaped into this patch?
> - info->swapped++;
> + info->swapped+=folio_nr_pages(folio);
Same comment as earlier.
> - info->alloced--;
> - info->swapped--;
> + info->alloced-=num_swap_pages;
> + info->swapped-=num_swap_pages;
Spacing
> - info->swapped--;
> + info->swapped-= folio_nr_pages(folio);
Spacing.