Re: [PATCH RFC 12/15] mm/smap: report workingset folios as referenced
Johannes Weiner <[email protected]> Mon, 3 Aug 2026 21:21:33 -0400
| Newsgroups | org.kernel.vger.linux-kernel,org.kernel.vger.cgroups,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 04, 2026 at 03:47:08AM +0800, Kairui Song via B4 Relay wrote:
> @@ -944,6 +944,22 @@ static void smaps_page_accumulate(struct mem_size_stats *mss,
> }
> }
>
> +static bool smap_check_folio_referenced(struct folio *folio)
> +{
> + if (lru_gen_enabled())
> + return folio_is_referenced(folio);
> + else
> + return folio_is_referenced_by_bit(folio);
> +}
> +
> +static void smap_clear_folio_referenced(struct folio *folio)
> +{
> + if (lru_gen_enabled())
> + folio_set_lru_refs(folio, 0);
> + else
> + folio_clear_referenced_by_bit(folio);
> +}
I don't really understand this and the preceding 2 patches.
What is the benefit of a "shared" ref/workingset state implementation
when you then still have separate APIs for querying & modifying?
Switching some these callers from folio_test_workingset() to
folio_is_workingset()? But both functions continue to exist?
Why not make versions of folio_test_workingset(),
folio_test_referenced(), folio_clear_referenced() etc. that do the
arbitration (bit ops on classic, refs ops on mglru) and leave callers
that are only interested in boolean states, like here, alone?
folio_test_anon(), folio_test_lazyfree(), folio_test_swapcache() -
there are many examples where they don't just test a raw bit but
assess more complex, composed state.