Re: [v11 PATCH 2/3] mm: unmap VM_HUGETLB mappings with optimized path
From: Vlastimil Babka
Date: Wed Sep 26 2018 - 07:13:18 EST
On 9/19/18 7:03 PM, Yang Shi wrote:
> When unmapping VM_HUGETLB mappings, vm flags need to be updated. Since
> the vmas have been detached, so it sounds safe to update vm flags with
> read mmap_sem.
>
> Cc: Michal Hocko <mhocko@xxxxxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx>
Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> mm/mmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 982dd00..490340e 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2777,7 +2777,7 @@ static int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
> * update vm_flags.
> */
> if (downgrade &&
> - (tmp->vm_flags & (VM_HUGETLB | VM_PFNMAP)))
> + (tmp->vm_flags & VM_PFNMAP))
> downgrade = false;
>
> tmp = tmp->vm_next;
>