Pre-map file mappings from /dev/shm (--mpol-shm-premap mcexec argument)
This commit is contained in:
@@ -1321,6 +1321,36 @@ do_mmap(const intptr_t addr0, const size_t len0, const int prot,
|
||||
populate_len = memobj->size;
|
||||
}
|
||||
memobj_unlock(memobj);
|
||||
|
||||
/* Update PTEs for pre-mapped memory object */
|
||||
if ((memobj->flags & MF_PREMAP) &&
|
||||
(proc->mpol_flags & MPOL_SHM_PREMAP)) {
|
||||
int i;
|
||||
enum ihk_mc_pt_attribute ptattr;
|
||||
ptattr = arch_vrflag_to_ptattr(range->flag, PF_POPULATE, NULL);
|
||||
|
||||
for (i = 0; i < memobj->nr_pages; ++i) {
|
||||
error = ihk_mc_pt_set_range(proc->vm->address_space->page_table,
|
||||
proc->vm,
|
||||
(void *)range->start + (i * PAGE_SIZE),
|
||||
(void *)range->start + (i * PAGE_SIZE) +
|
||||
PAGE_SIZE,
|
||||
virt_to_phys(memobj->pages[i]),
|
||||
ptattr,
|
||||
PAGE_SHIFT);
|
||||
if (error) {
|
||||
kprintf("%s: ERROR: mapping %d page of pre-mapped file\n",
|
||||
__FUNCTION__, i);
|
||||
}
|
||||
}
|
||||
dkprintf("%s: memobj 0x%lx pre-mapped\n", __FUNCTION__, memobj);
|
||||
}
|
||||
/*
|
||||
else if (memobj->flags & MF_REG_FILE) {
|
||||
populated_mapping = 1;
|
||||
populate_len = memobj->size;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
error = 0;
|
||||
|
||||
Reference in New Issue
Block a user