|
@@ -801,8 +801,19 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg)
|
|
|
}
|
|
|
|
|
|
/* Shared mappings always use reserves */
|
|
|
- if (vma->vm_flags & VM_MAYSHARE)
|
|
|
- return true;
|
|
|
+ if (vma->vm_flags & VM_MAYSHARE) {
|
|
|
+ /*
|
|
|
+ * We know VM_NORESERVE is not set. Therefore, there SHOULD
|
|
|
+ * be a region map for all pages. The only situation where
|
|
|
+ * there is no region map is if a hole was punched via
|
|
|
+ * fallocate. In this case, there really are no reverves to
|
|
|
+ * use. This situation is indicated if chg != 0.
|
|
|
+ */
|
|
|
+ if (chg)
|
|
|
+ return false;
|
|
|
+ else
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
|
* Only the process that called mmap() has reserves for
|