Test "mcexec additional options (h, m, n, O, stack-premap)" on arm64

Change-Id: I85d5deb0433cc1208e4b6837dcc6d6dc2a7b7b52
This commit is contained in:
Shiratori, Takehiro
2018-11-23 16:03:33 +09:00
committed by Masamichi Takagi
parent dc1f96fee3
commit 00395d68d4
13 changed files with 866 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
/* node_bind.c COPYRIGHT FUJITSU LIMITED 2018 */
#include <stdio.h>
#include <stdlib.h>
#include <numaif.h>
#include <numa.h>
#include <errno.h>
static void show_usage(void)
{
printf("./node_bind <numa node>\n");
}
int main(int argc, char *argv[])
{
int mode = 0;
int result = -1;
unsigned long mask = 0;
unsigned long exp_mask = 0;
struct bitmask *bind_mask;
if (argc != 2) {
show_usage();
result = 0;
goto err;
}
bind_mask = numa_parse_nodestring_all(argv[1]);
if (bind_mask) {
int node;
for (node = 0; node <= numa_max_possible_node(); ++node) {
if (numa_bitmask_isbitset(bind_mask, node)) {
exp_mask |= (1UL << node);
}
}
}
if (get_mempolicy(&mode, &mask, sizeof(mask) * 8, 0, MPOL_F_NODE)) {
printf("get_mempolicy() failed. %d\n", errno);
goto err;
}
if (mask != exp_mask) {
printf("node_bind mask mismatch, ng. (exp:%lx, mask:%lx)\n",
exp_mask, mask);
goto err;
}
result = 0;
err:
return result;
}