1/* Malloc huge page support. Generic implementation.
2 Copyright (C) 2021-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but 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 the GNU C Library; see the file COPYING.LIB. If
17 not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _MALLOC_HUGEPAGES_H
20#define _MALLOC_HUGEPAGES_H
21
22#include <stddef.h>
23
24/* Return the default transparent huge page size. */
25unsigned long int __malloc_default_thp_pagesize (void) attribute_hidden;
26
27enum malloc_thp_mode_t
28{
29 malloc_thp_mode_always,
30 malloc_thp_mode_madvise,
31 malloc_thp_mode_never,
32 malloc_thp_mode_not_supported
33};
34
35enum malloc_thp_mode_t __malloc_thp_mode (void) attribute_hidden;
36
37/* Return the supported huge page size from the REQUESTED sizes on PAGESIZE
38 along with the required extra mmap flags on FLAGS, Requesting the value
39 of 0 returns the default huge page size, otherwise the value will be
40 matched against the sizes supported by the system. */
41void __malloc_hugepage_config (size_t requested, size_t *pagesize, int *flags)
42 attribute_hidden;
43
44#endif /* _MALLOC_HUGEPAGES_H */
45

source code of glibc/sysdeps/generic/malloc-hugepages.h