devobj/fileobj: do not try to free memory for device file mappings
This commit is contained in:
@ -1097,7 +1097,8 @@ static int clear_range_l1(void *args0, pte_t *ptep, uint64_t base,
|
|||||||
page = phys_to_page(phys);
|
page = phys_to_page(phys);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page && page_is_in_memobj(page) && (old & PFL1_DIRTY)) {
|
if (page && page_is_in_memobj(page) && (old & PFL1_DIRTY) &&
|
||||||
|
!(args->memobj->flags & MF_ZEROFILL)) {
|
||||||
memobj_flush_page(args->memobj, phys, PTL1_SIZE);
|
memobj_flush_page(args->memobj, phys, PTL1_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1271,6 +1272,9 @@ static int clear_range(struct page_table *pt, struct process_vm *vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
args.free_physical = free_physical;
|
args.free_physical = free_physical;
|
||||||
|
if (memobj && (memobj->flags & MF_DEV_FILE)) {
|
||||||
|
args.free_physical = 0;
|
||||||
|
}
|
||||||
args.memobj = memobj;
|
args.memobj = memobj;
|
||||||
args.vm = vm;
|
args.vm = vm;
|
||||||
|
|
||||||
|
|||||||
@ -768,6 +768,8 @@ enum {
|
|||||||
MF_IS_REMOVABLE = 0x0004,
|
MF_IS_REMOVABLE = 0x0004,
|
||||||
MF_PREFETCH = 0x0008,
|
MF_PREFETCH = 0x0008,
|
||||||
MF_ZEROFILL = 0x0010,
|
MF_ZEROFILL = 0x0010,
|
||||||
|
MF_REG_FILE = 0x1000,
|
||||||
|
MF_DEV_FILE = 0x2000,
|
||||||
MF_END
|
MF_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ int devobj_create(int fd, size_t len, off_t off, struct memobj **objp, int *maxp
|
|||||||
__FUNCTION__, fd, len, off, result.handle, result.maxprot);
|
__FUNCTION__, fd, len, off, result.handle, result.maxprot);
|
||||||
|
|
||||||
obj->memobj.ops = &devobj_ops;
|
obj->memobj.ops = &devobj_ops;
|
||||||
obj->memobj.flags = MF_HAS_PAGER;
|
obj->memobj.flags = MF_HAS_PAGER | MF_DEV_FILE;
|
||||||
obj->memobj.size = len;
|
obj->memobj.size = len;
|
||||||
obj->handle = result.handle;
|
obj->handle = result.handle;
|
||||||
obj->ref = 1;
|
obj->ref = 1;
|
||||||
|
|||||||
@ -213,7 +213,7 @@ int fileobj_create(int fd, struct memobj **objp, int *maxprotp)
|
|||||||
|
|
||||||
memset(newobj, 0, sizeof(*newobj));
|
memset(newobj, 0, sizeof(*newobj));
|
||||||
newobj->memobj.ops = &fileobj_ops;
|
newobj->memobj.ops = &fileobj_ops;
|
||||||
newobj->memobj.flags = MF_HAS_PAGER;
|
newobj->memobj.flags = MF_HAS_PAGER | MF_REG_FILE;
|
||||||
newobj->handle = result.handle;
|
newobj->handle = result.handle;
|
||||||
newobj->sref = 1;
|
newobj->sref = 1;
|
||||||
newobj->cref = 1;
|
newobj->cref = 1;
|
||||||
|
|||||||
@ -34,6 +34,8 @@ enum {
|
|||||||
MF_IS_REMOVABLE = 0x0004,
|
MF_IS_REMOVABLE = 0x0004,
|
||||||
MF_PREFETCH = 0x0008,
|
MF_PREFETCH = 0x0008,
|
||||||
MF_ZEROFILL = 0x0010,
|
MF_ZEROFILL = 0x0010,
|
||||||
|
MF_REG_FILE = 0x1000,
|
||||||
|
MF_DEV_FILE = 0x2000,
|
||||||
MF_END
|
MF_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user