Lines Matching +full:start +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 1994-1999 Linus Torvalds
19 * MS_SYNC syncs the entire file - including mappings.
21 * MS_ASYNC does not start I/O (it used to, up to 2.5.67).
22 * Nor does it marks the relevant pages dirty (it used to up to 2.6.17).
27 * Or the application may run fadvise(FADV_DONTNEED) against the fd to start
32 SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) in SYSCALL_DEFINE3() argument
35 struct mm_struct *mm = current->mm; in SYSCALL_DEFINE3()
38 int error = -EINVAL; in SYSCALL_DEFINE3()
40 start = untagged_addr(start); in SYSCALL_DEFINE3()
44 if (offset_in_page(start)) in SYSCALL_DEFINE3()
48 error = -ENOMEM; in SYSCALL_DEFINE3()
50 end = start + len; in SYSCALL_DEFINE3()
51 if (end < start) in SYSCALL_DEFINE3()
54 if (end == start) in SYSCALL_DEFINE3()
57 * If the interval [start,end) covers some unmapped address ranges, in SYSCALL_DEFINE3()
58 * just ignore them, but return -ENOMEM at the end. Besides, if the in SYSCALL_DEFINE3()
59 * flag is MS_ASYNC (w/o MS_INVALIDATE) the result would be -ENOMEM in SYSCALL_DEFINE3()
63 vma = find_vma(mm, start); in SYSCALL_DEFINE3()
68 /* Still start < end. */ in SYSCALL_DEFINE3()
69 error = -ENOMEM; in SYSCALL_DEFINE3()
72 /* Here start < vma->vm_end. */ in SYSCALL_DEFINE3()
73 if (start < vma->vm_start) { in SYSCALL_DEFINE3()
76 start = vma->vm_start; in SYSCALL_DEFINE3()
77 if (start >= end) in SYSCALL_DEFINE3()
79 unmapped_error = -ENOMEM; in SYSCALL_DEFINE3()
81 /* Here vma->vm_start <= start < vma->vm_end. */ in SYSCALL_DEFINE3()
83 (vma->vm_flags & VM_LOCKED)) { in SYSCALL_DEFINE3()
84 error = -EBUSY; in SYSCALL_DEFINE3()
87 file = vma->vm_file; in SYSCALL_DEFINE3()
88 fstart = (start - vma->vm_start) + in SYSCALL_DEFINE3()
89 ((loff_t)vma->vm_pgoff << PAGE_SHIFT); in SYSCALL_DEFINE3()
90 fend = fstart + (min(end, vma->vm_end) - start) - 1; in SYSCALL_DEFINE3()
91 start = vma->vm_end; in SYSCALL_DEFINE3()
93 (vma->vm_flags & VM_SHARED)) { in SYSCALL_DEFINE3()
98 if (error || start >= end) in SYSCALL_DEFINE3()
101 vma = find_vma(mm, start); in SYSCALL_DEFINE3()
103 if (start >= end) { in SYSCALL_DEFINE3()
107 vma = find_vma(mm, vma->vm_end); in SYSCALL_DEFINE3()