Debian Codegraph @

libhugetlbfs_privutils.h

raw symbols SCIP
1 /*
2 * libhugetlbfs - Easy use of Linux hugepages
3 * Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 /*
21 * This file should only contain definitions of functions, data types, and
22 * constants which are part of the internal private utilities interfaces.
23 * These are exposed only to utilities and tests within the source, this is
24 * not a public interface nor part of the libhugetlfs API.
25 *
26 * All functions declared external here must be externalised using a define
27 * of the following form:
28 *
29 * #define foo __pu_foo
30 */
31
32 #ifndef _LIBHUGETLBFS_PRIVUTILS_H
33 #define _LIBHUGETLBFS_PRIVUTILS_H
34
35 /* Hugetlb pool counter operations */
36 /* Keys for reading hugetlb pool counters */
37 enum { /* The number of pages of a given size that ... */
38 HUGEPAGES_TOTAL, /* are allocated to the pool */
39 HUGEPAGES_TOTAL_MEMPOL, /* are allocated following the NUMA mempolicy */
40 HUGEPAGES_FREE, /* are not in use */
41 HUGEPAGES_RSVD, /* are reserved for possible future use */
42 HUGEPAGES_SURP, /* are allocated to the pool on demand */
43 HUGEPAGES_OC, /* can be allocated on demand - maximum */
44 HUGEPAGES_MAX_COUNTERS,
45 };
46 #define get_huge_page_counter __pu_get_huge_page_counter
47 long get_huge_page_counter(long pagesize, unsigned int counter);
48 #define set_huge_page_counter __pu_set_huge_page_counter
49 int set_huge_page_counter(long pagesize, unsigned int counter,
50 unsigned long val);
51 #define set_nr_hugepages __pu_set_nr_hugepages
52 int set_nr_hugepages(long pagesize, unsigned long val);
53 #define set_nr_overcommit_hugepages __pu_set_nr_overcommit_hugepages
54 int set_nr_overcommit_hugepages(long pagesize, unsigned long val);
55
56 #define arch_has_slice_support __pu_arch_has_slice_support
57 int arch_has_slice_support(void);
58
59 #define kernel_has_hugepages __pu_kernel_has_hugepages
60 int kernel_has_hugepages(void);
61
62 #define kernel_has_overcommit __pu_kernel_has_overcommit
63 int kernel_has_overcommit(void);
64
65 #define read_meminfo __pu_read_meminfo
66 long read_meminfo(const char *tag);
67
68 #define kernel_default_hugepage_size __pu_kernel_default_hugepage_size
69 long kernel_default_hugepage_size(void);
70
71 #define read_nr_overcommit __pu_read_nr_overcommit
72 long read_nr_overcommit(long page_size);
73
74 #define restore_overcommit_pages __pu_restore_overcommit_pages
75 void restore_overcommit_pages(long page_size, long oc_pool);
76
77 /* Kernel feature testing */
78 /* This enum defines the bits in a feature bitmask */
79 enum {
80 /* Reservations are created for private mappings */
81 HUGETLB_FEATURE_PRIVATE_RESV,
82
83 /* Whether use of MAP_NORESERVE is safe or can result in OOM */
84 HUGETLB_FEATURE_SAFE_NORESERVE,
85
86 /* If the kernel has the ability to mmap(MAP_HUGETLB)*/
87 HUGETLB_FEATURE_MAP_HUGETLB,
88
89 HUGETLB_FEATURE_NR,
90 };
91 #define hugetlbfs_test_feature __pu_hugetlbfs_test_feature
92 int hugetlbfs_test_feature(int feature_code);
93
94 #define test_compare_kver __pu_test_compare_kver
95 int test_compare_kver(const char *a, const char *b);
96
97 #endif /* _LIBHUGETLBFS_PRIVUTILS_H */