Instead of alloc_frozen_pages(), I was wondering if we should have something
like GFP_FROZEN. For example, for two PG_offline users
I'd currently also need alloc_contig_frozen_range() and
alloc_contig_frozen_pages(). Using alloc_contig_range(GFP_FROZEN)
alloc_contig_pages(GFP_PROZEN) would make that easier.
Did you consider that already?
I think Yu Zhao's recent patches:
e98337d11bbd ("mm/contig_alloc: support __GFP_COMP")
463586e9ff39 ("mm/cma: add cma_{alloc,free}_folio()")
cf54f310d0d3 ("mm/hugetlb: use __GFP_COMP for gigantic folios")
get us most of the way there.
What I really want to do is make contig allocation not do anything with
the refcounts. Hoist that into the callers which actually want it
(probably not many), and then we can actually drop the __GFP_COMP
support to alloc_contig_range_noprof().
Right, at least virtio-mem cannot easily support
alloc_contig_pages(__GFP_COMP; we'd need splitting support, and it
should be a separate effort than reworking PageOffline; and it would all
be in vain if we drop __GFP_COMP later again :
So regarding the PageOffline refcount rework it would be easier to do it
stepwise
1) add GFP_FROZEN support to alloc_contig_*
2) convert the two alloc_contig_*+PageOffline users to use that
3) convert the remaining alloc_contig_* users to GFP_FROZEN
4) make GFP_FROZEN implicit (drop it?) and drop __GFP_COMP
3) is a bigger task, likely too big to do in one shot.
--
Cheers,
David / dhildenb