mcexec: --mpol-threshold to control MPOL_BIND/MPOL_PREFERRED
This commit is contained in:
@@ -129,7 +129,7 @@ int prepare_process_ranges_args_envs(struct thread *thread,
|
||||
|
||||
/* Non-TEXT sections that are large respect user allocation policy
|
||||
* unless user explicitly requests otherwise */
|
||||
if (i >= 1 && pn->sections[i].len >= AP_USER_THRESHOLD &&
|
||||
if (i >= 1 && pn->sections[i].len >= pn->mpol_threshold &&
|
||||
!(pn->mpol_flags & MPOL_NO_BSS)) {
|
||||
dkprintf("%s: section: %d size: %d pages -> IHK_MC_AP_USER\n",
|
||||
__FUNCTION__, i, range_npages);
|
||||
@@ -429,6 +429,7 @@ static int process_msg_prepare_process(unsigned long rphys)
|
||||
proc->fsgid = pn->cred[7];
|
||||
proc->termsig = SIGCHLD;
|
||||
proc->mpol_flags = pn->mpol_flags;
|
||||
proc->mpol_threshold = pn->mpol_threshold;
|
||||
|
||||
vm->region.user_start = pn->user_start;
|
||||
vm->region.user_end = pn->user_end;
|
||||
|
||||
@@ -555,6 +555,7 @@ struct process {
|
||||
long maxrss_children;
|
||||
/* Memory policy flags */
|
||||
unsigned long mpol_flags;
|
||||
size_t mpol_threshold;
|
||||
|
||||
// perf_event
|
||||
int perf_status;
|
||||
|
||||
@@ -193,6 +193,7 @@ struct program_load_desc {
|
||||
struct rlimit rlimit[MCK_RLIM_MAX];
|
||||
unsigned long interp_align;
|
||||
unsigned long mpol_flags;
|
||||
unsigned long mpol_threshold;
|
||||
char shell_path[SHELL_PATH_MAX_LEN];
|
||||
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
||||
struct program_image_section sections[0];
|
||||
|
||||
@@ -93,6 +93,7 @@ init_process(struct process *proc, struct process *parent)
|
||||
proc->sgid = parent->sgid;
|
||||
proc->fsgid = parent->fsgid;
|
||||
proc->mpol_flags = parent->mpol_flags;
|
||||
proc->mpol_threshold = parent->mpol_threshold;
|
||||
memcpy(proc->rlimit, parent->rlimit,
|
||||
sizeof(struct rlimit) * MCK_RLIM_MAX);
|
||||
}
|
||||
@@ -1928,7 +1929,7 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn,
|
||||
|
||||
/* Apply user allocation policy to stacks */
|
||||
/* TODO: make threshold kernel or mcexec argument */
|
||||
ap_flag = (size >= AP_USER_THRESHOLD &&
|
||||
ap_flag = (size >= proc->mpol_threshold &&
|
||||
!(proc->mpol_flags & MPOL_NO_STACK)) ? IHK_MC_AP_USER : 0;
|
||||
dkprintf("%s: size: %lu %s\n", __FUNCTION__, size,
|
||||
ap_flag ? "(IHK_MC_AP_USER)" : "");
|
||||
|
||||
@@ -1430,7 +1430,7 @@ do_mmap(const intptr_t addr0, const size_t len0, const int prot,
|
||||
/* Small allocations mostly benefit from closest RAM,
|
||||
* otherwise follow user requested policy */
|
||||
unsigned long ap_flag =
|
||||
(!(flags & MAP_STACK) && len >= AP_USER_THRESHOLD) ||
|
||||
(!(flags & MAP_STACK) && len >= thread->proc->mpol_threshold) ||
|
||||
((flags & MAP_STACK) && !(thread->proc->mpol_flags & MPOL_NO_STACK)) ?
|
||||
IHK_MC_AP_USER : 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user