mcexec: --extend-heap-by: argument to specify heap extension size

This commit is contained in:
Balazs Gerofi
2017-03-07 14:23:28 +09:00
parent 29ab087fa2
commit e901d42fb6
7 changed files with 59 additions and 8 deletions

View File

@@ -129,6 +129,7 @@ struct program_load_desc {
unsigned long interp_align;
unsigned long mpol_flags;
unsigned long mpol_threshold;
unsigned long heap_extension;
int nr_processes;
char shell_path[SHELL_PATH_MAX_LEN];
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];

View File

@@ -160,6 +160,7 @@ static int mpol_no_stack = 0;
static int mpol_no_bss = 0;
static int no_bind_ikc_map = 0;
static unsigned long mpol_threshold = 0;
static unsigned long heap_extension = (2*1024*1024);
static int profile = 0;
static int disable_sched_yield = 0;
@@ -1116,7 +1117,7 @@ static int reduce_stack(struct rlimit *orig_rlim, char *argv[])
void print_usage(char **argv)
{
fprintf(stderr, "usage: %s [-c target_core] [-n nr_partitions] [--mpol-threshold=N] [--mpol-no-heap] [--mpol-no-bss] [--mpol-no-stack] [<mcos-id>] (program) [args...]\n", argv[0]);
fprintf(stderr, "usage: %s [-c target_core] [-n nr_partitions] [--mpol-threshold=N] [--enable-straight-map] [--extend-heap-by=N] [--mpol-no-heap] [--mpol-no-bss] [--mpol-no-stack] [<mcos-id>] (program) [args...]\n", argv[0]);
}
void init_sigaction(void)
@@ -1329,6 +1330,12 @@ static struct option mcexec_options[] = {
.flag = &disable_sched_yield,
.val = 1,
},
{
.name = "extend-heap-by",
.has_arg = required_argument,
.flag = NULL,
.val = 'h',
},
/* end */
{ NULL, 0, NULL, 0, },
};
@@ -1381,7 +1388,7 @@ int main(int argc, char **argv)
}
/* Parse options ("+" denotes stop at the first non-option) */
while ((opt = getopt_long(argc, argv, "+c:n:t:m:", mcexec_options, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "+c:n:t:m:h:", mcexec_options, NULL)) != -1) {
switch (opt) {
case 'c':
target_core = atoi(optarg);
@@ -1399,6 +1406,10 @@ int main(int argc, char **argv)
mpol_threshold = atol(optarg);
break;
case 'h':
heap_extension = atol(optarg);
break;
case 0: /* long opt */
break;
@@ -1788,6 +1799,7 @@ int main(int argc, char **argv)
}
desc->mpol_threshold = mpol_threshold;
desc->heap_extension = heap_extension;
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
perror("prepare");