On Thu, Apr 11, 2024 at 05:00:33PM +0800, Miaohe Lin wrote: > But as code changes, the above page lock shift is gone. And I think below logic can't > trigger now. As we hold extra page refcnt so page can't be coallesced into a new THP or Slab page. So I was wrong. I did not check the slap part, but I did check the code that tries to coallesce pages. We have the following check in hpage_collapse_scan_pmd(): /* * * Here the check may be racy: * it may see total_mapcount > refcount in some cases? * But such case is ephemeral we could always retry collapse * later. However it may report false positive if the page * has excessive GUP pins (i.e. 512). Anyway the same check * will be done again later the risk seems low. */ if (!is_refcount_suitable(folio)) { result = SCAN_PAGE_COUNT; goto out_unmap; } So I guess that since we hold an extra refcount from memory-failure code, this page cannot be part of a THP anymore. If we confirm that the same goes for slab, I would replace that with your warn check. In this way, if we ever trigger that warn path, as least we will know that that possibility exists. So it is a good way to get rid of false assumptions and code burden. -- Oscar Salvador SUSE Labs