Added error handling for illegal NUMA nodes in memory allocator.

This commit is contained in:
Michael Mueller
2024-08-28 15:19:16 +02:00
parent 3db8d834e5
commit b946a2b15f

View File

@@ -38,6 +38,8 @@ public:
inline void *local_allocate(const std::uint8_t numa_node_id, const std::size_t size) inline void *local_allocate(const std::uint8_t numa_node_id, const std::size_t size)
{ {
if (heaps[numa_node_id] == nullptr)
Genode::error("No local heap for NUMA node ", numa_node_id);
return heaps[numa_node_id]->alloc(size); return heaps[numa_node_id]->alloc(size);
} }
@@ -95,6 +97,8 @@ public:
{ {
void *ptr = nullptr; void *ptr = nullptr;
posix_memalign(&ptr, 64, alignment_helper::next_multiple(size, 64UL)); posix_memalign(&ptr, 64, alignment_helper::next_multiple(size, 64UL));
if (!ptr)
Genode::error("posix_memalign returned NULL");
return ptr; return ptr;
} }