Re: [PATCH v2 00/33] Separate struct slab from struct page
From: Matthew Wilcox <hidden>
Date: 2021-12-20 01:51:07
Also in:
linux-iommu, linux-mm, linux-patches
On Mon, Dec 20, 2021 at 01:47:54AM +0100, Vlastimil Babka wrote:
quoted
* mm/slub: Convert print_page_info() to print_slab_info() Do we really need to explicitly convert slab_folio()'s result to (struct folio *)?Unfortunately yes, as long as folio_flags() don't take const struct folio *, which will need some yak shaving.
In case anyone's interested ...
folio_flags calls VM_BUG_ON_PGFLAGS() which would need its second
argument to be const.
That means dump_page() needs to take a const struct page, which
means __dump_page() needs its argument to be const.
That calls ...
is_migrate_cma_page()
page_mapping()
page_mapcount()
page_ref_count()
page_to_pgoff()
page_to_pfn()
hpage_pincount_available()
head_compound_mapcount()
head_compound_pincount()
compound_order()
PageKsm()
PageAnon()
PageCompound()
... and at that point, I ran out of motivation to track down some parts
of this tarbaby that could be fixed. I did do:
mm: constify page_count and page_ref_count
mm: constify get_pfnblock_flags_mask and get_pfnblock_migratetype
mm: make compound_head const-preserving
mm/page_owner: constify dump_page_owner
so some of those are already done. But a lot of them just need to be
done at the same time. For example, page_mapping() calls
folio_mapping() which calls folio_test_slab() which calls folio_flags(),
so dump_page() and page_mapping() need to be done at the same time.
One bit that could be broken off easily (I think ...) is PageTransTail()
PageTail(), PageCompound(), PageHuge(), page_to_pgoff() and
page_to_index(). One wrinkle is needed a temporary
TESTPAGEFLAGS_FALSE_CONST. But I haven't tried it yet.