1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* 3f08c3bdfSopenharmony_ci * Copyright (c) 2016-2019 FUJITSU LIMITED. All rights reserved. 4f08c3bdfSopenharmony_ci * Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> 5f08c3bdfSopenharmony_ci * Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com> 6f08c3bdfSopenharmony_ci * Ported: Xiao Yang <yangx.jy@cn.fujitsu.com> 7f08c3bdfSopenharmony_ci * Ported: Yang Xu <xuyang2018.jy@cn.jujitsu.com> 8f08c3bdfSopenharmony_ci */ 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_ci/*\ 11f08c3bdfSopenharmony_ci * [Description] 12f08c3bdfSopenharmony_ci * 13f08c3bdfSopenharmony_ci * *Test 1* 14f08c3bdfSopenharmony_ci * 15f08c3bdfSopenharmony_ci * This is a regression test for the race condition between move_pages() 16f08c3bdfSopenharmony_ci * and freeing hugepages, where move_pages() calls follow_page(FOLL_GET) 17f08c3bdfSopenharmony_ci * for hugepages internally and tries to get its refcount without 18f08c3bdfSopenharmony_ci * preventing concurrent freeing. 19f08c3bdfSopenharmony_ci * 20f08c3bdfSopenharmony_ci * This test can crash the buggy kernel, and the bug was fixed in: 21f08c3bdfSopenharmony_ci * 22f08c3bdfSopenharmony_ci * commit e66f17ff71772b209eed39de35aaa99ba819c93d 23f08c3bdfSopenharmony_ci * Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> 24f08c3bdfSopenharmony_ci * Date: Wed Feb 11 15:25:22 2015 -0800 25f08c3bdfSopenharmony_ci * 26f08c3bdfSopenharmony_ci * mm/hugetlb: take page table lock in follow_huge_pmd() 27f08c3bdfSopenharmony_ci * 28f08c3bdfSopenharmony_ci * *Test 2.1* 29f08c3bdfSopenharmony_ci * 30f08c3bdfSopenharmony_ci * This is a regression test for the race condition, where move_pages() 31f08c3bdfSopenharmony_ci * and soft offline are called on a single hugetlb page concurrently. 32f08c3bdfSopenharmony_ci * 33f08c3bdfSopenharmony_ci * This test can crash the buggy kernel, and was fixed by: 34f08c3bdfSopenharmony_ci * 35f08c3bdfSopenharmony_ci * commit c9d398fa237882ea07167e23bcfc5e6847066518 36f08c3bdfSopenharmony_ci * Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> 37f08c3bdfSopenharmony_ci * Date: Fri Mar 31 15:11:55 2017 -0700 38f08c3bdfSopenharmony_ci * 39f08c3bdfSopenharmony_ci * mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() 40f08c3bdfSopenharmony_ci * 41f08c3bdfSopenharmony_ci * *Test 2.2* 42f08c3bdfSopenharmony_ci * 43f08c3bdfSopenharmony_ci * This is also a regression test for an race condition causing SIGBUS 44f08c3bdfSopenharmony_ci * in hugepage migration/fault. 45f08c3bdfSopenharmony_ci * 46f08c3bdfSopenharmony_ci * This bug was fixed by: 47f08c3bdfSopenharmony_ci * 48f08c3bdfSopenharmony_ci * commit 4643d67e8cb0b3536ef0ab5cddd1cedc73fa14ad 49f08c3bdfSopenharmony_ci * Author: Mike Kravetz <mike.kravetz@oracle.com> 50f08c3bdfSopenharmony_ci * Date: Tue Aug 13 15:38:00 2019 -0700 51f08c3bdfSopenharmony_ci * 52f08c3bdfSopenharmony_ci * hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS 53f08c3bdfSopenharmony_ci * 54f08c3bdfSopenharmony_ci * *Test 2.3* 55f08c3bdfSopenharmony_ci * 56f08c3bdfSopenharmony_ci * The madvise() in the do_soft_online() was also triggering cases where soft 57f08c3bdfSopenharmony_ci * online returned EIO when page migration failed, which was fixed in: 58f08c3bdfSopenharmony_ci * 59f08c3bdfSopenharmony_ci * commit 3f4b815a439adfb8f238335612c4b28bc10084d8 60f08c3bdfSopenharmony_ci * Author: Oscar Salvador <osalvador@suse.de> 61f08c3bdfSopenharmony_ci * Date: Mon Dec 14 19:11:51 2020 -0800 62f08c3bdfSopenharmony_ci * 63f08c3bdfSopenharmony_ci * mm,hwpoison: return -EBUSY when migration fails 64f08c3bdfSopenharmony_ci */ 65f08c3bdfSopenharmony_ci 66f08c3bdfSopenharmony_ci#include <errno.h> 67f08c3bdfSopenharmony_ci#include <unistd.h> 68f08c3bdfSopenharmony_ci#include <string.h> 69f08c3bdfSopenharmony_ci#include <stdio.h> 70f08c3bdfSopenharmony_ci#include <sys/types.h> 71f08c3bdfSopenharmony_ci#include <sys/wait.h> 72f08c3bdfSopenharmony_ci 73f08c3bdfSopenharmony_ci#include "tst_test.h" 74f08c3bdfSopenharmony_ci#include "move_pages_support.h" 75f08c3bdfSopenharmony_ci#include "lapi/mmap.h" 76f08c3bdfSopenharmony_ci 77f08c3bdfSopenharmony_ci#ifdef HAVE_NUMA_V2 78f08c3bdfSopenharmony_ci 79f08c3bdfSopenharmony_ci#define LOOPS 1000 80f08c3bdfSopenharmony_ci#define PATH_MEMINFO "/proc/meminfo" 81f08c3bdfSopenharmony_ci#define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages" 82f08c3bdfSopenharmony_ci#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/" 83f08c3bdfSopenharmony_ci#define TEST_NODES 2 84f08c3bdfSopenharmony_ci 85f08c3bdfSopenharmony_cistatic struct tcase { 86f08c3bdfSopenharmony_ci int tpages; 87f08c3bdfSopenharmony_ci int offline; 88f08c3bdfSopenharmony_ci} tcases[] = { 89f08c3bdfSopenharmony_ci {2, 0}, 90f08c3bdfSopenharmony_ci {2, 1}, 91f08c3bdfSopenharmony_ci}; 92f08c3bdfSopenharmony_ci 93f08c3bdfSopenharmony_cistatic int pgsz, hpsz; 94f08c3bdfSopenharmony_cistatic long orig_hugepages = -1; 95f08c3bdfSopenharmony_cistatic char path_hugepages_node1[PATH_MAX]; 96f08c3bdfSopenharmony_cistatic char path_hugepages_node2[PATH_MAX]; 97f08c3bdfSopenharmony_cistatic long orig_hugepages_node1 = -1; 98f08c3bdfSopenharmony_cistatic long orig_hugepages_node2 = -1; 99f08c3bdfSopenharmony_cistatic unsigned int node1, node2; 100f08c3bdfSopenharmony_cistatic void *addr; 101f08c3bdfSopenharmony_ci 102f08c3bdfSopenharmony_cistatic int do_soft_offline(int tpgs) 103f08c3bdfSopenharmony_ci{ 104f08c3bdfSopenharmony_ci if (madvise(addr, tpgs * hpsz, MADV_SOFT_OFFLINE) == -1) { 105f08c3bdfSopenharmony_ci if (errno != EINVAL && errno != EBUSY) 106f08c3bdfSopenharmony_ci tst_res(TFAIL | TERRNO, "madvise failed"); 107f08c3bdfSopenharmony_ci return errno; 108f08c3bdfSopenharmony_ci } 109f08c3bdfSopenharmony_ci return 0; 110f08c3bdfSopenharmony_ci} 111f08c3bdfSopenharmony_ci 112f08c3bdfSopenharmony_cistatic void do_child(int tpgs) 113f08c3bdfSopenharmony_ci{ 114f08c3bdfSopenharmony_ci int test_pages = tpgs * hpsz / pgsz; 115f08c3bdfSopenharmony_ci int i, j; 116f08c3bdfSopenharmony_ci int *nodes, *status; 117f08c3bdfSopenharmony_ci void **pages; 118f08c3bdfSopenharmony_ci pid_t ppid = getppid(); 119f08c3bdfSopenharmony_ci 120f08c3bdfSopenharmony_ci pages = SAFE_MALLOC(sizeof(char *) * test_pages); 121f08c3bdfSopenharmony_ci nodes = SAFE_MALLOC(sizeof(int) * test_pages); 122f08c3bdfSopenharmony_ci status = SAFE_MALLOC(sizeof(int) * test_pages); 123f08c3bdfSopenharmony_ci 124f08c3bdfSopenharmony_ci for (i = 0; i < test_pages; i++) 125f08c3bdfSopenharmony_ci pages[i] = addr + i * pgsz; 126f08c3bdfSopenharmony_ci 127f08c3bdfSopenharmony_ci for (i = 0; ; i++) { 128f08c3bdfSopenharmony_ci for (j = 0; j < test_pages; j++) { 129f08c3bdfSopenharmony_ci if (i % 2 == 0) 130f08c3bdfSopenharmony_ci nodes[j] = node1; 131f08c3bdfSopenharmony_ci else 132f08c3bdfSopenharmony_ci nodes[j] = node2; 133f08c3bdfSopenharmony_ci status[j] = 0; 134f08c3bdfSopenharmony_ci } 135f08c3bdfSopenharmony_ci 136f08c3bdfSopenharmony_ci TEST(numa_move_pages(ppid, test_pages, 137f08c3bdfSopenharmony_ci pages, nodes, status, MPOL_MF_MOVE_ALL)); 138f08c3bdfSopenharmony_ci if (TST_RET < 0) { 139f08c3bdfSopenharmony_ci if (errno == ENOMEM) 140f08c3bdfSopenharmony_ci continue; 141f08c3bdfSopenharmony_ci 142f08c3bdfSopenharmony_ci tst_res(TFAIL | TTERRNO, "move_pages failed"); 143f08c3bdfSopenharmony_ci break; 144f08c3bdfSopenharmony_ci } 145f08c3bdfSopenharmony_ci } 146f08c3bdfSopenharmony_ci 147f08c3bdfSopenharmony_ci exit(0); 148f08c3bdfSopenharmony_ci} 149f08c3bdfSopenharmony_ci 150f08c3bdfSopenharmony_cistatic void do_test(unsigned int n) 151f08c3bdfSopenharmony_ci{ 152f08c3bdfSopenharmony_ci int i, ret; 153f08c3bdfSopenharmony_ci void *ptr; 154f08c3bdfSopenharmony_ci pid_t cpid = -1; 155f08c3bdfSopenharmony_ci int status; 156f08c3bdfSopenharmony_ci 157f08c3bdfSopenharmony_ci addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ | PROT_WRITE, 158f08c3bdfSopenharmony_ci MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); 159f08c3bdfSopenharmony_ci 160f08c3bdfSopenharmony_ci SAFE_MUNMAP(addr, tcases[n].tpages * hpsz); 161f08c3bdfSopenharmony_ci 162f08c3bdfSopenharmony_ci cpid = SAFE_FORK(); 163f08c3bdfSopenharmony_ci if (cpid == 0) 164f08c3bdfSopenharmony_ci do_child(tcases[n].tpages); 165f08c3bdfSopenharmony_ci 166f08c3bdfSopenharmony_ci for (i = 0; i < LOOPS; i++) { 167f08c3bdfSopenharmony_ci ptr = mmap(NULL, tcases[n].tpages * hpsz, 168f08c3bdfSopenharmony_ci PROT_READ | PROT_WRITE, 169f08c3bdfSopenharmony_ci MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); 170f08c3bdfSopenharmony_ci if (ptr == MAP_FAILED) { 171f08c3bdfSopenharmony_ci if (i == 0) 172f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "Cannot allocate hugepage"); 173f08c3bdfSopenharmony_ci 174f08c3bdfSopenharmony_ci if (errno == ENOMEM) { 175f08c3bdfSopenharmony_ci usleep(1000); 176f08c3bdfSopenharmony_ci continue; 177f08c3bdfSopenharmony_ci } 178f08c3bdfSopenharmony_ci } 179f08c3bdfSopenharmony_ci 180f08c3bdfSopenharmony_ci if (ptr != addr) 181f08c3bdfSopenharmony_ci tst_brk(TBROK, "Failed to mmap at desired addr"); 182f08c3bdfSopenharmony_ci 183f08c3bdfSopenharmony_ci memset(addr, 0, tcases[n].tpages * hpsz); 184f08c3bdfSopenharmony_ci 185f08c3bdfSopenharmony_ci if (tcases[n].offline) { 186f08c3bdfSopenharmony_ci ret = do_soft_offline(tcases[n].tpages); 187f08c3bdfSopenharmony_ci 188f08c3bdfSopenharmony_ci if (ret == EINVAL) { 189f08c3bdfSopenharmony_ci SAFE_KILL(cpid, SIGKILL); 190f08c3bdfSopenharmony_ci SAFE_WAITPID(cpid, &status, 0); 191f08c3bdfSopenharmony_ci SAFE_MUNMAP(addr, tcases[n].tpages * hpsz); 192f08c3bdfSopenharmony_ci tst_res(TCONF, 193f08c3bdfSopenharmony_ci "madvise() didn't support MADV_SOFT_OFFLINE"); 194f08c3bdfSopenharmony_ci return; 195f08c3bdfSopenharmony_ci } 196f08c3bdfSopenharmony_ci } 197f08c3bdfSopenharmony_ci 198f08c3bdfSopenharmony_ci SAFE_MUNMAP(addr, tcases[n].tpages * hpsz); 199f08c3bdfSopenharmony_ci 200f08c3bdfSopenharmony_ci if (!tst_remaining_runtime()) 201f08c3bdfSopenharmony_ci break; 202f08c3bdfSopenharmony_ci } 203f08c3bdfSopenharmony_ci 204f08c3bdfSopenharmony_ci SAFE_KILL(cpid, SIGKILL); 205f08c3bdfSopenharmony_ci SAFE_WAITPID(cpid, &status, 0); 206f08c3bdfSopenharmony_ci if (!WIFEXITED(status)) 207f08c3bdfSopenharmony_ci tst_res(TPASS, "Bug not reproduced"); 208f08c3bdfSopenharmony_ci} 209f08c3bdfSopenharmony_ci 210f08c3bdfSopenharmony_cistatic void alloc_free_huge_on_node(unsigned int node, size_t size) 211f08c3bdfSopenharmony_ci{ 212f08c3bdfSopenharmony_ci char *mem; 213f08c3bdfSopenharmony_ci long ret; 214f08c3bdfSopenharmony_ci struct bitmask *bm; 215f08c3bdfSopenharmony_ci 216f08c3bdfSopenharmony_ci tst_res(TINFO, "Allocating and freeing %zu hugepages on node %u", 217f08c3bdfSopenharmony_ci size / hpsz, node); 218f08c3bdfSopenharmony_ci 219f08c3bdfSopenharmony_ci mem = mmap(NULL, size, PROT_READ | PROT_WRITE, 220f08c3bdfSopenharmony_ci MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); 221f08c3bdfSopenharmony_ci if (mem == MAP_FAILED) { 222f08c3bdfSopenharmony_ci if (errno == ENOMEM) 223f08c3bdfSopenharmony_ci tst_brk(TCONF, "Cannot allocate huge pages"); 224f08c3bdfSopenharmony_ci 225f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "mmap(..., MAP_HUGETLB, ...) failed"); 226f08c3bdfSopenharmony_ci } 227f08c3bdfSopenharmony_ci 228f08c3bdfSopenharmony_ci bm = numa_bitmask_alloc(numa_max_possible_node() + 1); 229f08c3bdfSopenharmony_ci if (!bm) 230f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "numa_bitmask_alloc() failed"); 231f08c3bdfSopenharmony_ci 232f08c3bdfSopenharmony_ci numa_bitmask_setbit(bm, node); 233f08c3bdfSopenharmony_ci 234f08c3bdfSopenharmony_ci ret = mbind(mem, size, MPOL_BIND, bm->maskp, bm->size + 1, 0); 235f08c3bdfSopenharmony_ci if (ret) { 236f08c3bdfSopenharmony_ci if (errno == ENOMEM) 237f08c3bdfSopenharmony_ci tst_brk(TCONF, "Cannot mbind huge pages"); 238f08c3bdfSopenharmony_ci 239f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "mbind() failed"); 240f08c3bdfSopenharmony_ci } 241f08c3bdfSopenharmony_ci 242f08c3bdfSopenharmony_ci TEST(mlock(mem, size)); 243f08c3bdfSopenharmony_ci if (TST_RET) { 244f08c3bdfSopenharmony_ci SAFE_MUNMAP(mem, size); 245f08c3bdfSopenharmony_ci if (TST_ERR == ENOMEM || TST_ERR == EAGAIN) 246f08c3bdfSopenharmony_ci tst_brk(TCONF, "Cannot lock huge pages"); 247f08c3bdfSopenharmony_ci tst_brk(TBROK | TTERRNO, "mlock failed"); 248f08c3bdfSopenharmony_ci } 249f08c3bdfSopenharmony_ci 250f08c3bdfSopenharmony_ci numa_bitmask_free(bm); 251f08c3bdfSopenharmony_ci 252f08c3bdfSopenharmony_ci SAFE_MUNMAP(mem, size); 253f08c3bdfSopenharmony_ci} 254f08c3bdfSopenharmony_ci 255f08c3bdfSopenharmony_cistatic void setup(void) 256f08c3bdfSopenharmony_ci{ 257f08c3bdfSopenharmony_ci int ret; 258f08c3bdfSopenharmony_ci long memfree; 259f08c3bdfSopenharmony_ci 260f08c3bdfSopenharmony_ci check_config(TEST_NODES); 261f08c3bdfSopenharmony_ci 262f08c3bdfSopenharmony_ci if (access(PATH_HUGEPAGES, F_OK)) 263f08c3bdfSopenharmony_ci tst_brk(TCONF, "Huge page not supported"); 264f08c3bdfSopenharmony_ci 265f08c3bdfSopenharmony_ci ret = get_allowed_nodes(NH_MEMS, TEST_NODES, &node1, &node2); 266f08c3bdfSopenharmony_ci if (ret < 0) 267f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "get_allowed_nodes: %d", ret); 268f08c3bdfSopenharmony_ci 269f08c3bdfSopenharmony_ci pgsz = (int)get_page_size(); 270f08c3bdfSopenharmony_ci SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "Hugepagesize: %d", &hpsz); 271f08c3bdfSopenharmony_ci 272f08c3bdfSopenharmony_ci SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "MemFree: %ld", &memfree); 273f08c3bdfSopenharmony_ci tst_res(TINFO, "Free RAM %ld kB", memfree); 274f08c3bdfSopenharmony_ci 275f08c3bdfSopenharmony_ci if (4 * hpsz > memfree) 276f08c3bdfSopenharmony_ci tst_brk(TBROK, "Not enough free RAM"); 277f08c3bdfSopenharmony_ci 278f08c3bdfSopenharmony_ci snprintf(path_hugepages_node1, sizeof(path_hugepages_node1), 279f08c3bdfSopenharmony_ci "/sys/devices/system/node/node%u/hugepages/hugepages-%dkB/nr_hugepages", 280f08c3bdfSopenharmony_ci node1, hpsz); 281f08c3bdfSopenharmony_ci 282f08c3bdfSopenharmony_ci snprintf(path_hugepages_node2, sizeof(path_hugepages_node2), 283f08c3bdfSopenharmony_ci "/sys/devices/system/node/node%u/hugepages/hugepages-%dkB/nr_hugepages", 284f08c3bdfSopenharmony_ci node2, hpsz); 285f08c3bdfSopenharmony_ci 286f08c3bdfSopenharmony_ci if (!access(path_hugepages_node1, F_OK)) { 287f08c3bdfSopenharmony_ci SAFE_FILE_SCANF(path_hugepages_node1, 288f08c3bdfSopenharmony_ci "%ld", &orig_hugepages_node1); 289f08c3bdfSopenharmony_ci tst_res(TINFO, 290f08c3bdfSopenharmony_ci "Increasing %dkB hugepages pool on node %u to %ld", 291f08c3bdfSopenharmony_ci hpsz, node1, orig_hugepages_node1 + 4); 292f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(path_hugepages_node1, 293f08c3bdfSopenharmony_ci "%ld", orig_hugepages_node1 + 4); 294f08c3bdfSopenharmony_ci } 295f08c3bdfSopenharmony_ci 296f08c3bdfSopenharmony_ci if (!access(path_hugepages_node2, F_OK)) { 297f08c3bdfSopenharmony_ci SAFE_FILE_SCANF(path_hugepages_node2, 298f08c3bdfSopenharmony_ci "%ld", &orig_hugepages_node2); 299f08c3bdfSopenharmony_ci tst_res(TINFO, 300f08c3bdfSopenharmony_ci "Increasing %dkB hugepages pool on node %u to %ld", 301f08c3bdfSopenharmony_ci hpsz, node2, orig_hugepages_node2 + 4); 302f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(path_hugepages_node2, 303f08c3bdfSopenharmony_ci "%ld", orig_hugepages_node2 + 4); 304f08c3bdfSopenharmony_ci } 305f08c3bdfSopenharmony_ci 306f08c3bdfSopenharmony_ci hpsz *= 1024; 307f08c3bdfSopenharmony_ci 308f08c3bdfSopenharmony_ci if (orig_hugepages_node1 == -1 || orig_hugepages_node2 == -1) { 309f08c3bdfSopenharmony_ci SAFE_FILE_SCANF(PATH_NR_HUGEPAGES, "%ld", &orig_hugepages); 310f08c3bdfSopenharmony_ci tst_res(TINFO, "Increasing global hugepages pool to %ld", 311f08c3bdfSopenharmony_ci orig_hugepages + 8); 312f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(PATH_NR_HUGEPAGES, "%ld", orig_hugepages + 8); 313f08c3bdfSopenharmony_ci } 314f08c3bdfSopenharmony_ci 315f08c3bdfSopenharmony_ci alloc_free_huge_on_node(node1, 4L * hpsz); 316f08c3bdfSopenharmony_ci alloc_free_huge_on_node(node2, 4L * hpsz); 317f08c3bdfSopenharmony_ci} 318f08c3bdfSopenharmony_ci 319f08c3bdfSopenharmony_cistatic void cleanup(void) 320f08c3bdfSopenharmony_ci{ 321f08c3bdfSopenharmony_ci if (orig_hugepages != -1) 322f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(PATH_NR_HUGEPAGES, "%ld", orig_hugepages); 323f08c3bdfSopenharmony_ci 324f08c3bdfSopenharmony_ci if (orig_hugepages_node1 != -1) { 325f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(path_hugepages_node1, 326f08c3bdfSopenharmony_ci "%ld", orig_hugepages_node1); 327f08c3bdfSopenharmony_ci } 328f08c3bdfSopenharmony_ci 329f08c3bdfSopenharmony_ci if (orig_hugepages_node2 != -1) { 330f08c3bdfSopenharmony_ci SAFE_FILE_PRINTF(path_hugepages_node2, 331f08c3bdfSopenharmony_ci "%ld", orig_hugepages_node2); 332f08c3bdfSopenharmony_ci } 333f08c3bdfSopenharmony_ci} 334f08c3bdfSopenharmony_ci 335f08c3bdfSopenharmony_cistatic struct tst_test test = { 336f08c3bdfSopenharmony_ci .needs_root = 1, 337f08c3bdfSopenharmony_ci .forks_child = 1, 338f08c3bdfSopenharmony_ci .setup = setup, 339f08c3bdfSopenharmony_ci .cleanup = cleanup, 340f08c3bdfSopenharmony_ci .test = do_test, 341f08c3bdfSopenharmony_ci .tcnt = ARRAY_SIZE(tcases), 342f08c3bdfSopenharmony_ci .max_runtime = 240, 343f08c3bdfSopenharmony_ci .tags = (const struct tst_tag[]) { 344f08c3bdfSopenharmony_ci {"linux-git", "e66f17ff7177"}, 345f08c3bdfSopenharmony_ci {"linux-git", "c9d398fa2378"}, 346f08c3bdfSopenharmony_ci {"linux-git", "4643d67e8cb0"}, 347f08c3bdfSopenharmony_ci {"linux-git", "3f4b815a439a"}, 348f08c3bdfSopenharmony_ci {} 349f08c3bdfSopenharmony_ci } 350f08c3bdfSopenharmony_ci}; 351f08c3bdfSopenharmony_ci 352f08c3bdfSopenharmony_ci#else 353f08c3bdfSopenharmony_ci TST_TEST_TCONF(NUMA_ERROR_MSG); 354f08c3bdfSopenharmony_ci#endif 355