On Wed, Aug 10, 2022 at 02:31:11PM +0200, Vlastimil Babka wrote: > On 8/9/22 19:18, Matthew Wilcox (Oracle) wrote: > > Since slab does not use the page refcount, it can allocate and > > free frozen pages, saving one atomic operation per free. > > > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > > Reviewed-by: William Kucharski <william.kucharski@xxxxxxxxxx> > > AFAICS the problem of has_unmovable_pages() is not addressed: > https://lore.kernel.org/all/40d658da-6220-e05e-ba0b-d95c82f6bfb3@xxxxxxxxxx/ > > But I don't think it's sustainable approach to enhance the checks there with > PageSlab() and then with whatever other user will adopt allocating frozen > pages in the future. I guess it would be better to just be able to detect > pages on pcplist without false positives. A new page type? Maybe the > overhead of managing it would be negligible as we set page->index anyway for > migratetype? > I think page type would be usable to identify a PCP page same as how it's used to identify a buddy page. Most likely, this could be done in check_pcp_refill, check_new_pcp (watch DEBUG_VM) and free_pcppages_bulk. There would be a race between the last refcount being dropped and becoming a PCP page but I doubt that matters to page isolation as I expect it retries. The __Clear and __Set operations would add some overhead but it's almost certainly cheaper than the put_page_testzero in __free_pages(). -- Mel Gorman SUSE Labs