Re: [PATCH v34 05/13] mm/damon: Implement primitives for the virtual memory address spaces

From: David Hildenbrand
Date: Thu Aug 26 2021 - 10:09:31 EST


+static void damon_va_mkold(struct mm_struct *mm, unsigned long addr)
+{
+ pte_t *pte = NULL;
+ pmd_t *pmd = NULL;
+ spinlock_t *ptl;
+

I just stumbled over this, sorry for the dumb questions:


a) What do we know about that region we are messing with?

AFAIU, just like follow_pte() and follow_pfn(), follow_invalidate_pte() should only be called on VM_IO and raw VM_PFNMAP mappings in general (see the doc of follow_pte()). Do you even know that it's within a single VMA and that there are no concurrent modifications?

b) Which locks are we holding?

I hope we're holding the mmap lock in read mode at least. Or how are you making sure there are no concurrent modifications to page tables / VMA layout ... ?

+ if (follow_invalidate_pte(mm, addr, NULL, &pte, &pmd, &ptl))



--
Thanks,

David / dhildenb