Re: [RFC PATCH v2 4/7] mm: pgtable: try to reclaim empty PTE pages in zap_page_range_single()

From: Qi Zheng
Date: Fri Aug 16 2024 - 06:07:25 EST




On 2024/8/16 18:03, David Hildenbrand wrote:

(b) if we didn't have to drop the PTL, we can remove the page table
      without even re-verifying whether the entries are pte_none(). We

If we want to remove the PTE page, we must hold the pmd lock (for
clearing pmd entry). To prevent ABBA deadlock, we must first release the
pte lock and then re-acquire the pmd lock + pte lock. Right? If so, then
rechecking pte_none() is unavoidable. Unless we hold the pmd lock + pte
lock in advance to execute the original code loop.

Try-locking the PMD should work, and succeed in many cases, right? And if that fails, we could fallback to what you describe.

Ah, right, I got it! Will try to do it in the next version.

Thanks,
Qi