On 1/20/25 11:43, Vlastimil Babka wrote: > On 1/20/25 11:39, David Hildenbrand wrote: >> On 17.01.25 17:29, Fuad Tabba wrote: >>> diff --git a/mm/swap.c b/mm/swap.c >>> index 10decd9dffa1..6f01b56bce13 100644 >>> --- a/mm/swap.c >>> +++ b/mm/swap.c >>> @@ -94,6 +94,20 @@ static void page_cache_release(struct folio *folio) >>> unlock_page_lruvec_irqrestore(lruvec, flags); >>> } >>> >>> +static void free_typed_folio(struct folio *folio) >>> +{ >>> + switch (folio_get_type(folio)) { >>> + case PGTY_hugetlb: >>> + free_huge_folio(folio); >>> + return; >>> + case PGTY_offline: >>> + /* Nothing to do, it's offline. */ >>> + return; >> >> Please drop the PGTY_offline part for now, it was rather to highlight >> what could be done. >> >> But the real goal will be to not make offline pages >> use the refcount at all (frozen). >> >> If we really want the temporary PGTY_offline change, it should be >> introduced separately. >> >> Apart from that LGTM! > > I gues you mean the WARN_ON_ONCE(1) should be dropped from the default: > handler as well, right? IIUC offline pages are not not yet frozen so there > will be warnings otherwise. And I haven't check if the other types are > frozen (I know slab is, very recently :) Oh and also free_typed_folio() would have to become bool and if it returns false, the normal freeing proceeds?