mremap: Don't premap destination vm_range

mremap works in the following steps:
(1) Unmap the destination memory area
(2) Create a new vm_range with add_process_memory_range
(3) Move the PTEs of the source range to the destination range by using move_pte_range

The problem is that step (3) expects the destination doesn't have any physical pages,
but step (2) premaps the destination when the optimization of premapping anonymous
map is turned on.

Change-Id: Ieeebd799b7169b9a6f6f658c204c31f49817030f
This commit is contained in:
Masamichi Takagi
2018-06-07 13:29:35 +09:00
committed by Balazs Gerofi
parent bacfb0c2b9
commit 3f26e44f85

View File

@ -7966,8 +7966,10 @@ if (!strcmp("./lammps", thread->proc->saved_cmdline))
if (range->memobj) {
memobj_ref(range->memobj);
}
/* Drop VR_PREALLOC to create vm_range without physical pages */
error = add_process_memory_range(thread->vm, newstart, newend, -1,
range->flag, range->memobj,
range->flag & ~VR_PREALLOC, range->memobj,
range->objoff + (oldstart - range->start),
range->pgshift, NULL);
if (error) {