Skip to content

Commit

Permalink
Fix less than page size in numa
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashmahar committed Jun 3, 2024
1 parent 2268074 commit 4540949
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/nvsl/numa.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static inline bool move_region_to_node(int node, void *start, size_t size,
size_t page_size = 4096) {
bool result = true;

const auto page_cnt = size / page_size;
const auto page_cnt = size < page_size ? 1 : size / page_size;
int *nodes = new int[page_cnt];
int *status = new int[page_cnt];
void **pages = new void *[page_cnt];
Expand All @@ -51,7 +51,8 @@ static inline bool move_region_to_node(int node, void *start, size_t size,

for (auto i = 0UL; i < page_cnt; i++) {
if (status[i] != node) {
std::cerr << "Warning: page " << i << " might not be on the target node. ";
std::cerr << "Warning: page " << i << " might not be on the target node. " << std::endl;
std::cerr << "perror: " << strerror(-status[i]) << std::endl;
std::cerr << "Expected: " << node << ", got: " << status[i] << std::endl;
std::cerr << "Not checking further pages." << std::endl;

Expand Down

0 comments on commit 4540949

Please # to comment.