Subject: Re: linux-next: build failure after merge of the mm tree

From: Andrew Morton <[email-masked]>
Date: Sun, 5 Mar 2023 19:13:35 -0800

On Mon, 6 Mar 2023 13:54:47 +1100 Stephen Rothwell <[email-masked]> wrote:

> Hi all,
> 
> After merging the mm tree, today's linux-next build (various) failed
> like this:
> 
> mm/khugepaged.c:1702:9: error: implicit declaration of function ‘vma_try_start_write’; did you mean ‘vma_start_write’? [-Werror=implicit-function-declaration]
> 
> Caused by commit
> 
>   92e3612279f9 ("mm/khugepaged: fix vm_lock/i_mmap_rwsem inversion in retract_page_tables")
> 
> The definition of vma_try_start_write() is protected by
> CONFIG_PER_VMA_LOCK, but its use is not.

Thanks.  Suren has a fix, but I haven't pushed it out yet :(

From: Suren Baghdasaryan <[email-masked]>
Subject: txt-mm-khugepaged-write-lock-vma-while-collapsing-a-huge-page-fix-fix
Date: Sat, 4 Mar 2023 15:24:15 -0800

I missed vma_try_start_write() definition for CONFIG_PER_VMA_LOCK=n
configuration.

Link: https://lkml.kernel.org/r/CAJuCfpFjWhtzRE1X=J+_JjgJzNKhq-=[email-masked]
Signed-off-by: Suren Baghdasaryan <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

--- a/include/linux/mm.h~mm-khugepaged-write-lock-vma-while-collapsing-a-huge-page-fix-fix
+++ a/include/linux/mm.h
@@ -717,6 +717,8 @@ static inline bool vma_start_read(struct
 		{ return false; }
 static inline void vma_end_read(struct vm_area_struct *vma) {}
 static inline void vma_start_write(struct vm_area_struct *vma) {}
+static inline bool vma_try_start_write(struct vm_area_struct *vma)
+		{ return true; }
 static inline void vma_assert_write_locked(struct vm_area_struct *vma) {}
 
 #endif /* CONFIG_PER_VMA_LOCK */
_