lkml.org 
[lkml]   [2023]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 5/5] mm/mmu_gather: Store and process pages in contig ranges
On Wed, Aug 30, 2023 at 10:50:11AM +0100, Ryan Roberts wrote:
> +++ b/include/asm-generic/tlb.h
> @@ -246,11 +246,11 @@ struct mmu_gather_batch {
> struct mmu_gather_batch *next;
> unsigned int nr;
> unsigned int max;
> - struct page *pages[];
> + struct pfn_range folios[];

I think it's dangerous to call this 'folios' as it lets you think that
each entry is a single folio. But as I understand this patch, you can
coagulate contiguous ranges across multiple folios.

> -void free_pages_and_swap_cache(struct page **pages, int nr)
> +void free_folios_and_swap_cache(struct pfn_range *folios, int nr)
> {
> lru_add_drain();
> for (int i = 0; i < nr; i++)
> - free_swap_cache(pages[i]);
> - release_pages(pages, nr);
> + free_swap_cache(pfn_to_page(folios[i].start));

... but here, you only put the swapcache for the first folio covered by
the range, not for each folio.

> + folios_put_refs(folios, nr);

It's kind of confusing to have folios_put() which takes a struct folio *
and then folios_put_refs() which takes a struct pfn_range *.
pfn_range_put()?

\
 
 \ /
  Last update: 2023-08-30 21:19    [W:0.117 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site