# Re: \[PATCH 05/13\] mm: convert THP VMA flag tests to use vma\_flags\_t

- From: Lorenzo Stoakes (ARM) \<ljs@kernel.org\>
- Date: 2026-11-09 12:27:23 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/11/17896935
- Thread: https://ratatoskr.run/linux-mm/2026/11/17874173/t.md

```text
On Fri, Nov 06, 2026 at 03:36:55PM +0100, David Hildenbrand (Arm) wrote:
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index 0d3bd9e23613..a2c7c6a0768d 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -640,7 +640,8 @@ static enum scan_result __collapse_huge_page_isolate(struct vm_area_struct *vma,
> >  		 * If the vma has the VM_DROPPABLE flag, the collapse will
> >  		 * preserve the lazyfree property without needing to skip.
> >  		 */
> > -		if (cc->policy.anon_skip_lazyfree && !(vma->vm_flags & VM_DROPPABLE) &&
> > +		if (cc->policy.anon_skip_lazyfree &&
> > +		    !vma_test_single_mask(vma, VMA_DROPPABLE) &&
> >  		    folio_test_lazyfree(folio) && !pte_dirty(pteval)) {
> >  			result = SCAN_PAGE_LAZYFREE;
> >  			goto out;
> > @@ -1683,7 +1684,8 @@ static enum scan_result collapse_scan_anon(struct vm_area_struct *vma,
> >  		 * If the vma has the VM_DROPPABLE flag, the collapse will
> >  		 * preserve the lazyfree property without needing to skip.
> >  		 */
> > -		if (cc->policy.anon_skip_lazyfree && !(vma->vm_flags & VM_DROPPABLE) &&
> > +		if (cc->policy.anon_skip_lazyfree &&
> > +		    !vma_test_single_mask(vma, VMA_DROPPABLE) &&
> >  		    folio_test_lazyfree(folio) && !pte_dirty(pteval)) {
> >  			result = SCAN_PAGE_LAZYFREE;
> >  			failed_pfn = folio_pfn(folio);
> > @@ -1948,7 +1950,7 @@ static enum scan_result try_collapse_pte_mapped_thp(struct mm_struct *mm, unsign
> >  	 * So page lock of folio does not protect from it, so we must not drop
> >  	 * ptl before pgt_pmd is removed, so uffd private needs pml taken now.
> >  	 */
> > -	if (userfaultfd_armed(vma) && !(vma->vm_flags & VM_SHARED))
> > +	if (userfaultfd_armed(vma) && !vma_test(vma, VMA_SHARED_BIT))
> >  		pml = pmd_lock(mm, pmd);
>
> A patch in mm/core.git will remove that entirely.
>
> Right now it results in a conflict between mm-new and mm/core.git.
>
> Beat to drop this here entirely. (I can also drop it when applying)

Sorry I missed this, feel free to apply with this bit removed!

--
Cheers, Lorenzo
```
