[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAA5enKbCuFqURVcPeYvboQYR8XMXzg9DzW-TghuF1HNbWHgwFQ@mail.gmail.com>
Date: Sat, 17 Jun 2023 21:50:26 +0100
From: Lorenzo Stoakes <lstoakes@...il.com>
To: "Vishal Moola (Oracle)" <vishal.moola@...il.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v2 5/5] mm: Remove is_longterm_pinnable_page() and
Reimplement folio_is_longterm_pinnable()
On Wed, 14 Jun 2023 at 03:14, Vishal Moola (Oracle)
<vishal.moola@...il.com> wrote:
>
> folio_is_longterm_pinnable() already exists as a wrapper function. Now
> that the whole implementation of is_longterm_pinnable_page() can be
> implemented using folios, folio_is_longterm_pinnable() can be made its
> own standalone function - and we can remove is_longterm_pinnable_page().
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
> include/linux/mm.h | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 27ce77080c79..e2d35e272e07 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1910,39 +1910,35 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
> return page_maybe_dma_pinned(page);
> }
>
> -/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */
> +/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin folios */
> #ifdef CONFIG_MIGRATION
> -static inline bool is_longterm_pinnable_page(struct page *page)
> +static inline bool folio_is_longterm_pinnable(struct folio *folio)
> {
> #ifdef CONFIG_CMA
> - int mt = get_pageblock_migratetype(page);
> + int mt = folio_migratetype(folio);
>
> if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE)
> return false;
> #endif
> /* The zero page may always be pinned */
> - if (is_zero_pfn(page_to_pfn(page)))
> + if (is_zero_pfn(folio_pfn(folio)))
> return true;
>
> /* Coherent device memory must always allow eviction. */
> - if (is_device_coherent_page(page))
> + if (folio_is_device_coherent(folio))
> return false;
>
> - /* Otherwise, non-movable zone pages can be pinned. */
> - return !is_zone_movable_page(page);
> + /* Otherwise, non-movable zone folios can be pinned. */
> + return !folio_is_zone_movable(folio);
> +
Nit, but you're adding a newline here.
> }
> #else
> -static inline bool is_longterm_pinnable_page(struct page *page)
> +static inline bool folio_is_longterm_pinnable(struct folio *folio)
> {
> return true;
> }
> #endif
>
> -static inline bool folio_is_longterm_pinnable(struct folio *folio)
> -{
> - return is_longterm_pinnable_page(&folio->page);
> -}
> -
> static inline void set_page_zone(struct page *page, enum zone_type zone)
> {
> page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
> --
> 2.40.1
>
>
Reviewed-by: Lorenzo Stoakes <lstoakes@...il.com>
Powered by blists - more mailing lists