suricata
util-hugepages.h
Go to the documentation of this file.
1 /* Copyright (C) 2023 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Lukas Sismis <lsismis@oisf.net>
22  */
23 
24 #ifndef UTIL_HUGEPAGES_H
25 #define UTIL_HUGEPAGES_H
26 
27 typedef struct {
28  uint32_t size_kb;
29  uint16_t allocated;
30  uint16_t free;
31 } HugepageInfo;
32 
33 // Structure to hold information about individual NUMA nodes in the system and
34 // and their respective allocated hugepages
35 // So for e.g. NUMA node 0 there can be 2 hugepage_size - 2 MB and 1 GB
36 // Each hugepage size will then have a record of number of allocated/free hpages
37 typedef struct {
40 } NodeInfo;
41 
42 // Structure to hold information about all hugepage sizes residing on all NUMA
43 // nodes in the system
44 typedef struct {
45  uint16_t num_nodes;
48 
52 
53 #endif /* UTIL_HUGEPAGES_H */
NodeInfo::hugepages
HugepageInfo * hugepages
Definition: util-hugepages.h:39
SystemHugepageSnapshotDestroy
void SystemHugepageSnapshotDestroy(SystemHugepageSnapshot *s)
Definition: util-hugepages.c:304
HugepageInfo::free
uint16_t free
Definition: util-hugepages.h:30
SystemHugepageSnapshot
Definition: util-hugepages.h:44
SystemHugepageSnapshot::num_nodes
uint16_t num_nodes
Definition: util-hugepages.h:45
SystemHugepageSnapshot::nodes
NodeInfo * nodes
Definition: util-hugepages.h:46
HugepageInfo::size_kb
uint32_t size_kb
Definition: util-hugepages.h:28
NodeInfo::num_hugepage_sizes
uint16_t num_hugepage_sizes
Definition: util-hugepages.h:38
HugepageInfo
Definition: util-hugepages.h:27
SystemHugepageEvaluateHugepages
void SystemHugepageEvaluateHugepages(SystemHugepageSnapshot *pre_s, SystemHugepageSnapshot *post_s)
The function compares two hugepage snapshots and prints out recommendations for hugepage configuratio...
Definition: util-hugepages.c:363
NodeInfo
Definition: util-hugepages.h:37
SystemHugepageSnapshotCreate
SystemHugepageSnapshot * SystemHugepageSnapshotCreate(void)
The function creates a snapshot of the system's hugepage usage per NUMA node and per hugepage size....
Definition: util-hugepages.c:323
HugepageInfo::allocated
uint16_t allocated
Definition: util-hugepages.h:29