1b18f20b59402f42b49389195b20466dbc5199f0
[dpdk.git] / lib / librte_eal / common / eal_memalloc.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017-2018 Intel Corporation
3  */
4
5 #ifndef EAL_MEMALLOC_H
6 #define EAL_MEMALLOC_H
7
8 #include <stdbool.h>
9
10 #include <rte_memory.h>
11
12 /*
13  * Allocate segment of specified page size.
14  */
15 struct rte_memseg *
16 eal_memalloc_alloc_seg(size_t page_sz, int socket);
17
18 /*
19  * Allocate `n_segs` segments.
20  *
21  * Note: `ms` can be NULL.
22  *
23  * Note: it is possible to request best-effort allocation by setting `exact` to
24  * `false`, in which case allocator will return however many pages it managed to
25  * allocate successfully.
26  */
27 int
28 eal_memalloc_alloc_seg_bulk(struct rte_memseg **ms, int n_segs, size_t page_sz,
29                 int socket, bool exact);
30
31 #endif /* EAL_MEMALLOC_H */