# HG changeset patch # User Paul Boddie # Date 1655501714 -7200 # Node ID 5ec3ddda4a794f8d645ce7708e6747aef13b3e81 # Parent e43f4434d45e74e621da2af07746e4b933c317ba Page-align the "hot spot" for compatibility with the receive size calculation. This aims to handle any unaligned "hot spot" values provided in map requests. diff -r e43f4434d45e -r 5ec3ddda4a79 libmem/lib/src/flexpage.cc --- a/libmem/lib/src/flexpage.cc Fri Jun 17 23:33:00 2022 +0200 +++ b/libmem/lib/src/flexpage.cc Fri Jun 17 23:35:14 2022 +0200 @@ -170,12 +170,16 @@ if (!receive_size) return SendFlexpage(base_addr, page_order(0), flags); - offset_t receive_page_offset = hot_spot % receive_size; + /* Employ the page-aligned hot spot for compatibility with the page + offset, thus handling any non-aligned values sent in map requests. */ + + offset_t hot_spot_page = trunc(hot_spot, PAGE_SIZE); + offset_t receive_page_offset = hot_spot_page % receive_size; while ((receive_size > PAGE_SIZE) && (receive_page_offset != page_offset)) { receive_size /= 2; - receive_page_offset = hot_spot % receive_size; + receive_page_offset = hot_spot_page % receive_size; } /* The flexpage base address is adjusted using the difference in page