LLMP: Fix page-size where allocated message is larger than the current map (#1997)

This commit is contained in:
Dominik Maier 2024-04-03 13:27:19 +02:00 committed by GitHub
parent 50be2f4aaf
commit e64233e203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1158,6 +1158,12 @@ where
(*page).size_total (*page).size_total
); );
// For future allocs, keep track of the maximum (aligned) alloc size we used
(*page).max_alloc_size = max(
(*page).max_alloc_size,
size_of::<LlmpMsg>() + buf_len_padded,
);
// We need enough space for the current page size_used + payload + padding // We need enough space for the current page size_used + payload + padding
if (*page).size_used + size_of::<LlmpMsg>() + buf_len_padded + EOP_MSG_SIZE if (*page).size_used + size_of::<LlmpMsg>() + buf_len_padded + EOP_MSG_SIZE
> (*page).size_total > (*page).size_total
@ -1189,12 +1195,6 @@ where
(*_llmp_next_msg_ptr(ret)).tag = LLMP_TAG_UNSET; (*_llmp_next_msg_ptr(ret)).tag = LLMP_TAG_UNSET;
(*ret).tag = LLMP_TAG_UNINITIALIZED; (*ret).tag = LLMP_TAG_UNINITIALIZED;
// For future allocs, keep track of the maximum (aligned) alloc size we used
(*page).max_alloc_size = max(
(*page).max_alloc_size,
size_of::<LlmpMsg>() + buf_len_padded,
);
self.has_unsent_message = true; self.has_unsent_message = true;
Some(ret) Some(ret)