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 #include "paging.h" 2 3 bool Paging::reserve(Accessor *accessor) 4 { 5 _lock.lock(); 6 7 return _mappers.find(accessor) != _mappers.end(); 8 } 9 10 PageMapper *Paging::get(Accessor *accessor) 11 { 12 AccessorMapping::iterator entry = _mappers.find(accessor); 13 PageMapper *mapper; 14 15 if (entry == _mappers.end()) 16 mapper = NULL; 17 else 18 mapper = entry->second; 19 20 _lock.unlock(); 21 return mapper; 22 } 23 24 void Paging::set(Accessor *accessor, PageMapper *mapper) 25 { 26 AccessorMapping::iterator entry = _mappers.find(accessor); 27 28 if (entry == _mappers.end()) 29 _mappers[accessor] = mapper; 30 31 _lock.unlock(); 32 } 33 34 // vim: tabstop=4 expandtab shiftwidth=4