Issue:
I meet an issue of the 'mlock()' API. the first load is fast when lock the memory from '"/sys/devices/system/node/node0"', but it is too slow on node1, about take more than 3s to return.
1637788891.109283 (+ 7.153795) set_mempolicy(MPOL_DEFAULT, NULL, 0) = 0 <0.000052>
who can help analize these logs, any help will be appreciated. below is a fraction of traces:
1637788883.562435 (+ 0.000263) openat(AT_FDCWD, "/sys/devices/system/node/online", O_RDONLY) = 4 <0.000033>
1637788883.562542 (+ 0.000108) read(4, "0-1\n", 4096) = 4 <0.000036>
1637788883.562647 (+ 0.000104) close(4) = 0 <0.000026>
1637788883.562730 (+ 0.000082) openat(AT_FDCWD, "/sys/devices/system/node/has_memory", O_RDONLY) = 4 <0.000038>
1637788883.562823 (+ 0.000093) read(4, "0-1\n", 4096) = 4 <0.000027>
1637788883.562905 (+ 0.000082) close(4) = 0 <0.000032>
1637788883.563036 (+ 0.000129) stat("/sys/devices/system/node/node0", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 <0.000050>
1637788883.563149 (+ 0.000114) openat(AT_FDCWD, "/sys/devices/system/node/node0/hugepages/hugepages-1048576kB/free_hugepages", O_RDONLY) = 4 <0.000031>
1637788883.563233 (+ 0.000083) read(4, "20\n", 4096) = 3 <0.000027>
1637788883.563313 (+ 0.000081) close(4) = 0 <0.000028>
1637788883.563389 (+ 0.000074) set_mempolicy(MPOL_BIND, [0x0000000000000001, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000], 1025) = 0 <0.000029>
1637788883.563494 (+ 0.000105) memfd_create("buffers-numa-0", MFD_HUGETLB) = 4 <0.000040>
1637788883.563581 (+ 0.000087) ftruncate(4, 1073741824) = 0 <0.000035>
1637788883.563676 (+ 0.000093) mmap(0x1000000000, 1073741824, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, 4, 0) = 0x1000000000 <0.000046>
1637788883.563783 (+ 0.000107) mlock(0x1000000000, 1073741824) = 0 <0.205897>
1637788883.921276 (+ 0.357521) set_mempolicy(MPOL_DEFAULT, NULL, 0) = 0 <0.000021>
1637788883.921386 (+ 0.000081) move_pages(0, 1, [0x1000000000], NULL, [0], 0) = 0 <0.000040>
1637788883.921539 (+ 0.000159) openat(AT_FDCWD, "/proc/self/pagemap", O_RDONLY) = 5 <0.000075>
1637788883.921712 (+ 0.000166) lseek(5, 134217728, SEEK_SET) = 134217728 <0.000028>
1637788883.921792 (+ 0.000079) read(5, "\0\0|\0\0\0\200\241", 8) = 8 <0.000050>
1637788883.921881 (+ 0.000089) close(5) = 0 <0.000034>
1637788883.954743 (+ 0.032867) stat("/sys/devices/system/node/node1", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 <0.000026>
1637788883.954838 (+ 0.000093) openat(AT_FDCWD, "/sys/devices/system/node/node1/hugepages/hugepages-1048576kB/free_hugepages", O_RDONLY) = 5 <0.000024>
1637788883.954925 (+ 0.000087) read(5, "20\n", 4096) = 3 <0.000023>
1637788883.955014 (+ 0.000089) close(5) = 0 <0.000081>
1637788883.955188 (+ 0.000168) set_mempolicy(MPOL_BIND, [0x0000000000000002, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000, 000000000000000000], 1025) = 0 <0.000034>
1637788883.955297 (+ 0.000108) memfd_create("buffers-numa-1", MFD_HUGETLB) = 5 <0.000030>
1637788883.955375 (+ 0.000078) ftruncate(5, 1073741824) = 0 <0.000046>
1637788883.955461 (+ 0.000085) mmap(0x1040000000, 1073741824, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, 5, 0) = 0x1040000000 <0.000036>
1637788883.955539 (+ 0.000078) mlock(0x1040000000, 1073741824) = 0 <3.520771>
**1637788891.109283 (+ 7.153795) set_mempolicy(MPOL_DEFAULT, NULL, 0) = 0 <0.000052>**
1637788891.109605 (+ 0.000271) move_pages(0, 1, [0x1040000000], NULL, [1], 0) = 0 <0.000057>
1637788891.109911 (+ 0.000312) openat(AT_FDCWD, "/proc/self/pagemap", O_RDONLY) = 6 <0.000125>
1637788891.110194 (+ 0.000276) lseek(6, 134217728, SEEK_SET) = 134217728 <0.000028>
1637788891.110299 (+ 0.000104) read(6, "\0\0|\0\0\0\200\241", 8) = 8 <0.000048>
1637788891.110416 (+ 0.000116) lseek(6, 136314880, SEEK_SET) = 136314880 <0.000017>
1637788891.110494 (+ 0.000078) read(6, "\0\0@\1\0\0\200\241", 8) = 8 <0.000046>