[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aA7ElItPhzNi2hCe@casper.infradead.org>
Date: Mon, 28 Apr 2025 00:58:12 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Kairui Song <kasong@...cent.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Hugh Dickins <hughd@...gle.com>, Chris Li <chrisl@...nel.org>,
Yosry Ahmed <yosryahmed@...gle.com>,
"Huang, Ying" <ying.huang@...ux.alibaba.com>,
Nhat Pham <nphamcs@...il.com>, Johannes Weiner <hannes@...xchg.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/6] mm: move folio_index to mm/swap.h and remove no
longer needed helper
On Mon, Apr 28, 2025 at 02:59:07AM +0800, Kairui Song wrote:
> +++ b/mm/swap.h
> @@ -50,6 +50,24 @@ static inline pgoff_t swap_cache_index(swp_entry_t entry)
> return swp_offset(entry) & SWAP_ADDRESS_SPACE_MASK;
> }
>
> +/**
> + * folio_index - File index of a folio.
> + * @folio: The folio.
> + *
> + * For a folio which is either in the page cache or the swap cache,
> + * return its index within the address_space it belongs to. If you know
> + * the page is definitely in the page cache, you can look at the folio's
> + * index directly.
> + *
> + * Return: The index (offset in units of pages) of a folio in its file.
> + */
> +static inline pgoff_t folio_index(struct folio *folio)
> +{
> + if (unlikely(folio_test_swapcache(folio)))
> + return swap_cache_index(folio->swap);
> + return folio->index;
> +}
I think the build warning can be cured by moving this outside
CONFIG_SWAP
Powered by blists - more mailing lists