[PATCH v3 18/23] mm: update vma_supports_mlock() to use new VMA flags

Lorenzo Stoakes (Oracle) posted 23 patches 2 weeks, 5 days ago
There is a newer version of this series
[PATCH v3 18/23] mm: update vma_supports_mlock() to use new VMA flags
Posted by Lorenzo Stoakes (Oracle) 2 weeks, 5 days ago
We now have the ability to test all of this using the new vma_flags_t
approach, so let's do so.

Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
---
 mm/internal.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/internal.h b/mm/internal.h
index 80d8651441a7..708d240b4198 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1252,7 +1252,9 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,
 
 static inline bool vma_supports_mlock(const struct vm_area_struct *vma)
 {
-	if (vma->vm_flags & (VM_SPECIAL | VM_DROPPABLE))
+	if (vma_test_any_mask(vma, VMA_SPECIAL_FLAGS))
+		return false;
+	if (vma_test_single_mask(vma, VMA_DROPPABLE))
 		return false;
 	if (vma_is_dax(vma) || is_vm_hugetlb_page(vma))
 		return false;
-- 
2.53.0
Re: [PATCH v3 18/23] mm: update vma_supports_mlock() to use new VMA flags
Posted by Vlastimil Babka (SUSE) 2 weeks, 3 days ago
On 3/18/26 16:50, Lorenzo Stoakes (Oracle) wrote:
> We now have the ability to test all of this using the new vma_flags_t
> approach, so let's do so.
> 
> Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>

Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>


> ---
>  mm/internal.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/internal.h b/mm/internal.h
> index 80d8651441a7..708d240b4198 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1252,7 +1252,9 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,
>  
>  static inline bool vma_supports_mlock(const struct vm_area_struct *vma)
>  {
> -	if (vma->vm_flags & (VM_SPECIAL | VM_DROPPABLE))
> +	if (vma_test_any_mask(vma, VMA_SPECIAL_FLAGS))
> +		return false;
> +	if (vma_test_single_mask(vma, VMA_DROPPABLE))
>  		return false;
>  	if (vma_is_dax(vma) || is_vm_hugetlb_page(vma))
>  		return false;