From: Liam R. Howlett Date: Mon, 4 Jan 2021 20:02:28 +0000 (-0500) Subject: mm/mprotect: Use maple tree navigation instead of vma linked list X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=761acb92b50f6e03336b31a6d6826adbd0e0a01c;p=users%2Fjedix%2Flinux-maple.git mm/mprotect: Use maple tree navigation instead of vma linked list Signed-off-by: Liam R. Howlett --- diff --git a/mm/mprotect.c b/mm/mprotect.c index 883e2cc85cad..56b761bc7316 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -528,6 +528,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len, const int grows = prot & (PROT_GROWSDOWN|PROT_GROWSUP); const bool rier = (current->personality & READ_IMPLIES_EXEC) && (prot & PROT_READ); + MA_STATE(mas, ¤t->mm->mm_mt, start, start); start = untagged_addr(start); @@ -559,11 +560,12 @@ static int do_mprotect_pkey(unsigned long start, size_t len, if ((pkey != -1) && !mm_pkey_is_allocated(current->mm, pkey)) goto out; - vma = find_vma(current->mm, start); + vma = mas_find(&mas, ULONG_MAX); error = -ENOMEM; if (!vma) goto out; - prev = vma->vm_prev; + + prev = mas_prev(&mas, 0); if (unlikely(grows & PROT_GROWSDOWN)) { if (vma->vm_start >= end) goto out; @@ -644,7 +646,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len, if (nstart >= end) goto out; - vma = prev->vm_next; + vma = vma_next(current->mm, prev); if (!vma || vma->vm_start != nstart) { error = -ENOMEM; goto out;