Thread (15 messages) 15 messages, 4 authors, 2018-08-10

Re: [RFC v7 PATCH 1/4] mm: refactor do_munmap() to extract the common part

From: Vlastimil Babka <hidden>
Date: 2018-08-10 10:23:24
Also in: lkml

On 08/10/2018 01:36 AM, Yang Shi wrote:
Introduces three new helper functions:
  * addr_ok()
  * munmap_lookup_vma()
  * munlock_vmas()

They will be used by do_munmap() and the new do_munmap with zapping
large mapping early in the later patch.

There is no functional change, just code refactor.

Reviewed-by: Laurent Dufour <redacted>
Signed-off-by: Yang Shi <redacted>
Acked-by: Vlastimil Babka <redacted>

Small nit below.
quoted hunk ↗ jump to hunk
@@ -2764,13 +2812,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
 	 */
 	if (mm->locked_vm) {
 		struct vm_area_struct *tmp = vma;
-		while (tmp && tmp->vm_start < end) {
-			if (tmp->vm_flags & VM_LOCKED) {
-				mm->locked_vm -= vma_pages(tmp);
-				munlock_vma_pages_all(tmp);
-			}
-			tmp = tmp->vm_next;
-		}
+		munlock_vmas(tmp, end);
No need for 'tmp' here.
	
 	}
 
 	/*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help