ealanos: Fixes to hamstraaja.

This commit is contained in:
Michael Mueller
2025-05-11 22:05:07 +02:00
parent b0e46febfb
commit e20a605709
3 changed files with 13 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ class Ealan::Memory::Core_heap
{ return cap; },
[&](Ram_allocator::Alloc_error err)
{
Genode::error("Failed to allocate phyiscal memory in domain ", domain_id, ":", err);
Genode::error("Failed to allocate phyiscal memory in domain ", domain_id, ":", err, " avail quota: ", _pd.avail_ram());
return Ram_dataspace_capability(); });
if (!ds_cap.valid()) {
@@ -104,9 +104,6 @@ class Ealan::Memory::Core_heap
public:
Core_heap(Pd_session &pd, Region_map &rm) : _pd(pd), _rm(rm) {
Genode::log("Size of superblock array is ", sizeof(_superblocks));
Genode::log("Individual superblock size is: ", sizeof(Sb));
Genode::log("Size of individual ist of superblocks: ", sizeof(Ealan::util::MPSCQueue<Sb>));
}
~Core_heap()
@@ -131,7 +128,12 @@ class Ealan::Memory::Core_heap
if (size > MAX)
{
/* directly allocate a hyperblock */
Hyperblock *hb = _allocate_hyperblock(domain_id, size+sizeof(Hyperblock*) + sizeof(Ram_dataspace_capability));
Hyperblock *hb = _allocate_hyperblock(
domain_id, size + sizeof(Hyperblock *) + sizeof(Ram_dataspace_capability));
if (!hb) {
Genode::warning("Failed to allocate hyperblock of size ", size);
return nullptr;
}
hb->_next = reinterpret_cast<Hyperblock*>(magic_num);
return reinterpret_cast<char *>(hb) + sizeof(Hyperblock *) + sizeof(Ram_dataspace_capability);
}

View File

@@ -63,8 +63,8 @@ class Ealan::Memory::Hamstraaja : public Genode::Allocator
size_t num_cpus = Cip::cip()->habitat_affinity.total();
for (size_t cpu = 0; cpu < num_cpus; cpu++) {
_core_heaps[cpu] = new (_backend) Core_heap<MIN, MAX>(_pd, _rm);
Genode::log("Size of CoreHeap for size ", MAX * 2, " with ", MIN, " blocks is: ", sizeof(Core_heap<MIN, MAX>));
}
}
Genode::log("Hamstraaja initialized");
}
~Hamstraaja()
@@ -98,8 +98,8 @@ class Ealan::Memory::Hamstraaja : public Genode::Allocator
*/
void *alloc(size_t size, unsigned domain_id)
{
_quota_used += overhead(size) + size;
return _location_to_heap(_my_location()).aligned_alloc(size, 0, domain_id);
_quota_used += overhead(size) + size;
return _location_to_heap(_my_location()).aligned_alloc(size, domain_id, 0);
}
/**
@@ -111,7 +111,6 @@ class Ealan::Memory::Hamstraaja : public Genode::Allocator
void *alloc(size_t size)
{
_quota_used += overhead(size) + size;
//Genode::log("Allocating ", size, " bytes.");
return _location_to_heap(_my_location()).alloc(size);
}

View File

@@ -93,13 +93,13 @@ class Ealan::Memory::Superblock : public Hyperblock
if (_size_class > SIZE) {
Genode::error("Size class ", _size_class, " is bigger than superblock size ", SIZE);
}
/*Genode::log("Superblock SIZE=", SIZE, " BASE=", BASE, " this at ", this);
Genode::log("Superblock SIZE=", SIZE, " BASE=", BASE, " this at ", this);
Genode::log("Block metadata size is ", sizeof(Block));
Genode::log("Size class of superblock is ", _size_class);
Block *end = reinterpret_cast<Block *>(reinterpret_cast<Genode::addr_t>(this) + SIZE);
Genode::log("Superblock ends at ", end);
Genode::log("Capacity is ", capacity());
Genode::log("-------------------");*/
Genode::log("-------------------");
}
/**