2021-02-21 | Paul Boddie | raw annotate files changeset graph | Constrain the receive flexpage size to appropriate sizes. If the receive flexpage is constrained by the maximum offset to an intermediate size (not a power of two page size multiple such as 1, 2, 4, 8...) then too large a flexpage will be sent and the "hot spot" incorrectly divided, resulting in stray accesses to neighbouring pages. |
1 #pragma once 2 3 #include <list> 4 #include <mutex> 5 6 #include "memory_utils.h" 7 #include "region.h" 8 #include "types.h" 9 10 11 12 /* A memory pool abstraction. */ 13 14 class Memory 15 { 16 protected: 17 std::mutex _lock; 18 19 unsigned int _limit; 20 offset_t _region_size; 21 bool _limited; 22 23 public: 24 explicit Memory(unsigned int limit, offset_t region_size=PAGE_SIZE); 25 26 explicit Memory(); 27 28 Region *allocate(offset_t size); 29 30 Region *region(offset_t size); 31 32 Region *region(); 33 34 void release(Region *region); 35 }; 36 37 // vim: tabstop=4 expandtab shiftwidth=4