[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_gJy1h-IoRP0JDO@casper.infradead.org>
Date: Thu, 10 Apr 2025 19:11:23 +0100
From: Matthew Wilcox <willy@...radead.org>
To: nifan.cxl@...il.com
Cc: mcgrof@...nel.org, a.manzanares@...sung.com, dave@...olabs.net,
akpm@...ux-foundation.org, david@...hat.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, will@...nel.org,
aneesh.kumar@...nel.org, hca@...ux.ibm.com, gor@...ux.ibm.com,
linux-s390@...r.kernel.org, ziy@...dia.com,
Fan Ni <fan.ni@...sung.com>
Subject: Re: [PATCH] mm: Introduce free_folio_and_swap_cache() to replace
free_page_and_swap_cache()
On Thu, Apr 10, 2025 at 11:00:31AM -0700, nifan.cxl@...il.com wrote:
> @@ -522,8 +522,12 @@ static inline void put_swap_device(struct swap_info_struct *si)
> do { (val)->freeswap = (val)->totalswap = 0; } while (0)
> /* only sparc can not include linux/pagemap.h in this file
> * so leave put_page and release_pages undeclared... */
> -#define free_page_and_swap_cache(page) \
> - put_page(page)
> +#define free_folio_and_swap_cache(folio) \
> + do { \
> + if (!folio_test_slab(folio)) \
> + folio_put(folio); \
> + } while (0)
We don't need to test for slab. Unlike put_page(), we know that slab
cannot be passed this way.
Powered by blists - more mailing lists