[LTP] [PATCH v9 1/2] cpuset02: Convert the test6 from cpuset_memory_testset.sh to C code
Petr Vorel
pvorel@suse.cz
Mon Mar 31 12:37:51 CEST 2025
Hi Wei, Li, Cyril,
...
> +static void setup(void)
> +{
> + node = tst_get_nodemap(TST_NUMA_MEM, getpagesize() / 1024);
> + if (node->cnt <= 1)
> + tst_brk(TCONF, "test requires at least 2 NUMA memory nodes");
Naive question: why test requires 2 memory nodes? Wouldn't be 1 enough?
Kind regards,
Petr
> +
> + check_node_id = node->map[node->cnt - 1];
> +
> + hpage_size = SAFE_READ_MEMINFO(MEMINFO_HPAGE_SIZE)*1024;
> +
> + char path[256];
> + unsigned int i;
> + unsigned int nr_hugepages;
> +
> + for (i = 0; i < node->cnt; i++) {
> + unsigned int current_node_id = node->map[i];
> +
> + sprintf(path,
> + "/sys/devices/system/node/node%d/hugepages/hugepages-%ldkB/nr_hugepages",
> + current_node_id, hpage_size / 1024);
> + FILE_PRINTF(path, "%d", 1);
> + SAFE_FILE_SCANF(path, "%d", &nr_hugepages);
> + if (nr_hugepages != 1)
> + tst_brk(TCONF, "reserve 1 huge page on node%d failed", current_node_id);
> + }
> +}
More information about the ltp
mailing list