scan_pmd() requires mmap_lock held in read. Add a lockdep assertion to guard this condition, as scan_pmd() will be called from other contexts later in the series. Signed-off-by: Zach O'Keefe <zokeefe@xxxxxxxxxx> --- mm/khugepaged.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index b204bc1eefa7..56f2ef7146c7 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1253,6 +1253,7 @@ struct scan_pmd_result { struct page *head; }; +/* Called with mmap_lock held and does not drop it. */ static void scan_pmd(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, @@ -1267,6 +1268,7 @@ static void scan_pmd(struct mm_struct *mm, spinlock_t *ptl; int node = NUMA_NO_NODE; + mmap_assert_locked(mm); VM_BUG_ON(address & ~HPAGE_PMD_MASK); pmd = mm_find_pmd(mm, address); -- 2.35.1.616.g0bdcbb4464-goog