Merge tag 'v3.10.92'
[firefly-linux-kernel-4.4.55.git] / mm / hugetlb.c
index 4642000a2443f5cca02cc0a04d21c070b9ccedb0..de5b4f0644357c8ed7b859229772290763634a17 100644 (file)
@@ -2572,6 +2572,14 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
                if (iter_vma == vma)
                        continue;
 
+               /*
+                * Shared VMAs have their own reserves and do not affect
+                * MAP_PRIVATE accounting but it is possible that a shared
+                * VMA is using the same page so check and skip such VMAs.
+                */
+               if (iter_vma->vm_flags & VM_MAYSHARE)
+                       continue;
+
                /*
                 * Unmap the page from other VMAs without their own reserves.
                 * They get marked to be SIGKILLed if they fault in these