diff mbox series

[RFC,09/10] mm/khugepage.c: Warn if trying to scan devmap pmd

Message ID 68427031c58645ba4b751022bf032ffd6b247427.1712796818.git-series.apopple@nvidia.com (mailing list archive)
State New
Headers show
Series fs/dax: Fix FS DAX page reference counts | expand

Commit Message

Alistair Popple April 11, 2024, 12:57 a.m. UTC
The only user of devmap PTEs is FS DAX, and khugepaged should not be
scanning these VMAs. This is checked by calling
hugepage_vma_check. Therefore khugepaged should never encounter a
devmap PTE. Warn if this occurs.

Signed-off-by: Alistair Popple <apopple@nvidia.com>

---

Note this is a transitory patch to test the above assumption both at
runtime and during review. I will likely remove it as the whole thing
gets deleted when pXX_devmap is removed.
---
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Hildenbrand April 11, 2024, 1:45 p.m. UTC | #1
On 11.04.24 02:57, Alistair Popple wrote:
> The only user of devmap PTEs is FS DAX, and khugepaged should not be
> scanning these VMAs. This is checked by calling
> hugepage_vma_check. Therefore khugepaged should never encounter a
> devmap PTE. Warn if this occurs.
> 
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> 
> ---
> 
> Note this is a transitory patch to test the above assumption both at
> runtime and during review. I will likely remove it as the whole thing
> gets deleted when pXX_devmap is removed.

Yes, doesn't make sense for this patch to exist if it would go upstream 
along with the next patch that removes that completely.
Alistair Popple April 12, 2024, 1:34 a.m. UTC | #2
David Hildenbrand <david@redhat.com> writes:

> On 11.04.24 02:57, Alistair Popple wrote:
>> The only user of devmap PTEs is FS DAX, and khugepaged should not be
>> scanning these VMAs. This is checked by calling
>> hugepage_vma_check. Therefore khugepaged should never encounter a
>> devmap PTE. Warn if this occurs.
>> Signed-off-by: Alistair Popple <apopple@nvidia.com>
>> ---
>> Note this is a transitory patch to test the above assumption both at
>> runtime and during review. I will likely remove it as the whole thing
>> gets deleted when pXX_devmap is removed.
>
> Yes, doesn't make sense for this patch to exist if it would go
> upstream along with the next patch that removes that completely.

Yep. I'd had it to sanity check my own understanding and figured I'd
leave it in the RFC series to see if it provoked a reaction from anyone.

Will drop it in the next version.
diff mbox series

Patch

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 88433cc..b10db15 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -955,7 +955,7 @@  static int find_pmd_or_thp_or_none(struct mm_struct *mm,
 		return SCAN_PMD_NULL;
 	if (pmd_trans_huge(pmde))
 		return SCAN_PMD_MAPPED;
-	if (pmd_devmap(pmde))
+	if (WARN_ON_ONCE(pmd_devmap(pmde)))
 		return SCAN_PMD_NULL;
 	if (pmd_bad(pmde))
 		return SCAN_PMD_NULL;