On Wed, Jun 04, 2025 at 08:21:45AM +0000, Wei Yang wrote:
[...]
>+int try_to_move_page(char *region)
>+{
>+ int ret;
>+ int node;
>+ int status = 0;
>+
>+ ksft_print_msg("worker %d move_pages of content: %.15s\n", getpid(),
>region);
One thing confused me here.
If I don't access region here, the following move_pages() would report
-ENOENT occationally. The reason is do_pages_stat_array() ->
folio_walk_start() returns NULL.
Not sure which part I missed.
>+
>+ ret = move_pages(0, 1, (void **)®ion, NULL, &status,
>MPOL_MF_MOVE_ALL);
>+ if (ret != 0)
>+ return FAIL_ON_WORK;
>+
>+ /* Pick up a different target node */
>+ for (node = 0; node <= numa_max_node(); node++) {
>+ if (numa_bitmask_isbitset(numa_all_nodes_ptr, node) && node !=
>status)
>+ break;
>+ }
>+
>+ if (node > numa_max_node()) {
>+ ksft_print_msg("Couldn't find available numa node for
>testing\n");
>+ return FAIL_ON_WORK;
>+ }
>+
>+ ret = move_pages(0, 1, (void **)®ion, &node, &status,
>MPOL_MF_MOVE_ALL);
>+ if (ret != 0)
>+ return FAIL_ON_WORK;
>+
>+ return 0;
>+}
>+
--
Wei Yang
Help you, Help me