1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) 2019 Red Hat, Inc. 4 */ 5 6 #ifndef TST_HUGEPAGE__ 7 #define TST_HUGEPAGE__ 8 9 #define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/" 10 #define PATH_NR_HPAGES "/proc/sys/vm/nr_hugepages" 11 12 extern char *nr_opt; /* -s num Set the number of the been allocated hugepages */ 13 extern char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */ 14 15 /* 16 * Try the best to request a specified number of huge pages from system, 17 * it will store the reserved hpage number in tst_hugepages. 18 * 19 * Note: this depend on the status of system memory fragmentation. 20 */ 21 unsigned long tst_request_hugepages(unsigned long hpages); 22 23 /* 24 * This variable is used for recording the number of hugepages which system can 25 * provides. It will be equal to 'hpages' if tst_request_hugepages on success, 26 * otherwise set it to a number of hugepages that we were able to reserve. 27 * 28 * If system does not support hugetlb, then it will be set to 0. 29 */ 30 extern unsigned long tst_hugepages; 31 32 #endif /* TST_HUGEPAGE_H */ 33