PMEM2_SOURCE_NUMA_NODE(3)
π pmem2_source_numa_node(3) β PMDK Programmer's Manual π
okay bestie, sit down, we're learning about numa nodes and it's genuinely iconic.
β¨ NAME β¨
pmem2_source_numa_node() β returns data source numa node π¦
β¨ SYNOPSIS β¨
#include <libpmem2.h>
struct pmem2_source;
int pmem2_source_numa_node(const struct pmem2_source *source, int *numa_node);
β¨ DESCRIPTION β¨
so like, the pmem2_source_numa_node() function retrieves the numa node of the given data source. that's it, that's the whole job, and she does it flawlessly π
and why do you care about the numa node? because you can use it to, like, pin threads to near-memory cores β main character scheduling behaviour, no cap.
where does it go? the numa node gets stored in *numa_node. and listen β it's the same value that is shown as numa_node in ndctl list -v, so if you've ever squinted at that output, congrats, it's the same number. periodt. π
β¨ RETURN VALUE β¨
pmem2_source_numa_node() returns 0 on success, slay. πΈ
but if the function fails, the *numa_node variable is left unmodified and a negative error code is returned. so don't go reading *numa_node like it's fresh data when it isn't, bestie, that's how you get got π
β¨ ERRORS β¨
here's the vibe check on what can go wrong β pmem2_source_numa_node() can fail with the following errors:
PMEM2_E_NOSUPPβ source type or operating system not supported (peep the#caveatsfor details π)PMEM2_E_DAX_REGION_NOT_FOUNDβ nondctl_regioncould be determined for the source. she looked. she found nothing. πPMEM2_E_INVALID_FILE_TYPEβ if the source points to a directory-errnoβ set by failingndctl_new, while trying to create a new context
β¨ CAVEATS β¨
okay this is the part where we get real, so pay attention π«Ά
- this call requires
libndctlto retrieve the numa information. no libndctl, no numa info, that's just how it is. - it only works for sources that are actually located on persistent memory, i.e.,
devdaxorfsdax. not optional. not negotiable. - as anonymous sources are not backed by files on persistent memory, this method is not supported for them. sorry anonymous sources, this one's not for you π
- it also does not work under systems without
libndctl. same energy, said twice, because it matters.
β¨ SEE ALSO β¨
errno(3), ndctl_new(3), pmem2_source_from_fd(3), libpmem2(7), libndctl(7) and https://pmem.io π
and that's the whole page, bestie β brought to you by the PMDK girlies, dated 2025-07-24, source/version line reading PMDK - (yes, that's literally all it says, she's mysterious like that π). go forth and numa node responsibly. ππ
π¦ where this page comes from
- fedora 43: libpmem2-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2020-2023, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms