MM: straight mapping

Change-Id: I70871f8c382fb00aa719ed501cc5de436d916d7f
This commit is contained in:
Balazs Gerofi
2020-05-27 13:54:04 +09:00
committed by Masamichi Takagi
parent 100bbe6231
commit 201f5ce500
13 changed files with 385 additions and 21 deletions

View File

@ -150,6 +150,8 @@ struct program_load_desc {
int thp_disable;
int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */
int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */
int straight_map;
size_t straight_map_threshold;
int nr_processes;
int process_rank;
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];

View File

@ -655,6 +655,9 @@ static int rus_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
goto put_and_out;
}
// Force regular page size
pgsize = PAGE_SIZE;
rva = (unsigned long)addr & ~(pgsize - 1);
rpa = rpa & ~(pgsize - 1);
@ -666,7 +669,8 @@ static int rus_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
/* LWK may hold large page based mappings that align rva outside
* Linux' VMA, make sure we don't try to map to those pages */
if (rva + (pix * PAGE_SIZE) < vma->vm_start) {
if (rva + (pix * PAGE_SIZE) < vma->vm_start ||
rva + (pix * PAGE_SIZE) > vma->vm_end) {
continue;
}
@ -677,11 +681,11 @@ static int rus_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
if (error) {
pr_err("%s: error inserting mapping for 0x%#lx "
"(req: TID: %d, syscall: %lu) error: %d,"
" vm_start: 0x%lx, vm_end: 0x%lx\n",
" vm_start: 0x%lx, vm_end: 0x%lx, pgsize: %lu, ind: %lu\n",
__func__,
(unsigned long)addr, packet.fault_tid,
rsysnum, error,
vma->vm_start, vma->vm_end);
vma->vm_start, vma->vm_end, pgsize, pix);
}
}
else

View File

@ -187,6 +187,8 @@ static int mpol_no_stack = 0;
static int mpol_no_bss = 0;
static int mpol_shm_premap = 0;
static int no_bind_ikc_map = 0;
static int straight_map = 0;
static unsigned long straight_map_threshold = (1024*1024);
static unsigned long mpol_threshold = 0;
static unsigned long heap_extension = -1;
static int profile = 0;
@ -1674,6 +1676,18 @@ static struct option mcexec_options[] = {
.flag = NULL,
.val = 'M',
},
{
.name = "enable-straight-map",
.has_arg = no_argument,
.flag = &straight_map,
.val = 1,
},
{
.name = "straight-map-threshold",
.has_arg = required_argument,
.flag = NULL,
.val = 'S',
},
{
.name = "disable-sched-yield",
.has_arg = no_argument,
@ -2095,10 +2109,10 @@ int main(int argc, char **argv)
/* Parse options ("+" denotes stop at the first non-option) */
#ifdef ADD_ENVS_OPTION
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:",
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:S:",
mcexec_options, NULL)) != -1) {
#else /* ADD_ENVS_OPTION */
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:",
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:S:",
mcexec_options, NULL)) != -1) {
#endif /* ADD_ENVS_OPTION */
switch (opt) {
@ -2140,6 +2154,10 @@ int main(int argc, char **argv)
heap_extension = atobytes(optarg);
break;
case 'S':
straight_map_threshold = atobytes(optarg);
break;
#ifdef ADD_ENVS_OPTION
case 'e':
add_env_list(&extra_env, optarg);
@ -2678,6 +2696,9 @@ int main(int argc, char **argv)
desc->uti_use_last_cpu = uti_use_last_cpu;
desc->thp_disable = get_thp_disable();
desc->straight_map = straight_map;
desc->straight_map_threshold = straight_map_threshold;
/* user_start and user_end are set by this call */
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
perror("prepare");