void setup(void) { int ret, memnode; tst_require_root(NULL); tst_sig(FORK, DEF_HANDLER, cleanup); TEST_PAUSE; overcommit = get_sys_tune("overcommit_memory"); set_sys_tune("overcommit_memory", 1, 1); mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW); mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW); write_memcg(); /* * Some nodes do not contain memory, so use * get_allowed_nodes(NH_MEMS) to get a memory * node. This operation also applies to Non-NUMA * systems. */ ret = get_allowed_nodes(NH_MEMS, 1, &memnode); if (ret < 0) tst_brkm(TBROK, NULL, "Failed to get a memory node " "using get_allowed_nodes()"); write_cpusets(memnode); }
int main(int argc, char *argv[]) { int lc; int size = 128, num = 3, unit = 1; tst_parse_opts(argc, argv, ksm_options, ksm_usage); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; check_ksm_options(&size, &num, &unit); write_memcg(); create_same_memory(size, num, unit); } cleanup(); tst_exit(); }
int main(int argc, char *argv[]) { int lc; char *msg; int size = 128, num = 3, unit = 1; msg = parse_opts(argc, argv, ksm_options, ksm_usage); if (msg != NULL) tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; check_ksm_options(&size, &num, &unit); write_memcg(); create_same_memory(size, num, unit); } cleanup(); tst_exit(); }
int main(int argc, char *argv[]) { int lc; char *msg; int size = 128, num = 3, unit = 1; unsigned long nnodes = 1; unsigned long nmask = 2; msg = parse_opts(argc, argv, ksm_options, ksm_usage); if (msg != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); nnodes = count_numa(); if (count_numa() <= 1) tst_brkm(TCONF, NULL, "required a NUMA system."); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; check_ksm_options(&size, &num, &unit); write_memcg(); if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1) { if (errno != ENOSYS) tst_brkm(TBROK|TERRNO, cleanup, "set_mempolicy"); else tst_brkm(TCONF, cleanup, "set_mempolicy syscall is not implemented on your system."); } create_same_memory(size, num, unit); write_cpusets(); create_same_memory(size, num, unit); } cleanup(); tst_exit(); }