rlib
Convenience library for useful things
Loading...
Searching...
No Matches
rmemnuma.h
Go to the documentation of this file.
1/* RLIB - Convenience library for useful things
2 * Copyright (C) 2026 Haakon Sporsheim <haakon.sporsheim@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3.0 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library.
16 * See the COPYING file at the root of the source repository.
17 */
48#ifndef __R_MEM_NUMA_H__
49#define __R_MEM_NUMA_H__
50
51#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
52#error "#include <rlib.h> only please."
53#endif
54
55#include <rlib/rtypes.h>
56
57#include <rlib/data/rbitset.h>
58
60
77
87
101
115
131 const RBitset * nodeset) R_ATTR_MALLOC;
132
143
160
175 const RBitset * nodeset);
176
191
192R_END_DECLS
193
196#endif /* __R_MEM_NUMA_H__ */
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
rboolean r_mem_numa_interleave(rpointer ptr, rsize size, const RBitset *nodeset)
Interleave the pages spanning ptr across nodeset.
void r_mem_numa_free(rpointer ptr, rsize size)
Release an allocation from this API.
rboolean r_mem_numa_available(void)
Whether this build and this machine actually place allocations on the node they are asked for.
rboolean r_mem_numa_bind(rpointer ptr, rsize size, ruint node)
Bind the pages spanning ptr to node node.
rpointer r_mem_numa_alloc_onnode(rsize size, ruint node)
Allocate size bytes bound to NUMA node node.
rpointer r_mem_numa_alloc_local(rsize size)
Allocate size bytes placed by the system's default policy.
rpointer r_mem_numa_alloc_interleaved(rsize size, const RBitset *nodeset)
Allocate size bytes spread page-by-page across nodeset.
rsize r_mem_numa_page_size(void)
Granularity every allocation here is rounded up to.
rboolean r_mem_numa_node_of(rconstpointer ptr, ruint *node)
Which node currently backs the page containing ptr.
int rboolean
Boolean type (typedef'd to int).
Definition rtypes.h:59
unsigned int ruint
Unsigned int.
Definition rtypes.h:157
void * rpointer
Generic pointer (alias for void *).
Definition rtypes.h:327
const void * rconstpointer
Generic const pointer (alias for const void *).
Definition rtypes.h:329
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290
Fixed-width bitset with bit / byte / word accessors and bitwise compound operations.
Foundational type aliases used by every rlib header.
Fixed-width bitset.
Definition rbitset.h:68