-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"new" memory allocator for LPs memory: DyMeLoR! #85
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #85 +/- ##
===========================================
- Coverage 87.89% 85.02% -2.87%
===========================================
Files 46 50 +4
Lines 2073 2545 +472
Branches 47 60 +13
===========================================
+ Hits 1822 2164 +342
- Misses 229 356 +127
- Partials 22 25 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Documentation coverage is 68.1% 👍
|
src/mm/dymelor/checkpoint.c
Outdated
|
||
area->alloc_chunks = ackpt->chunk_cnt; | ||
size_t bitmap_size = bitmap_required_size(num_chunks); | ||
memcpy(area->use_bitmap, ackpt->data, bitmap_size); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
src/mm/dymelor/checkpoint.c
Outdated
ackpt->i = i; | ||
ackpt->chunk_cnt = area->alloc_chunks; | ||
size_t bitmap_size = bitmap_required_size(num_chunks); | ||
memcpy(ackpt->data, area->use_bitmap, bitmap_size); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
|
||
#define copy_from_area(x) \ | ||
({ \ | ||
memcpy(ptr, area->area + ((x) * (chunk_size + sizeof(uint_least32_t))), chunk_size); \ |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
|
||
#define copy_to_area(x) \ | ||
({ \ | ||
memcpy(area->area + ((x) * (chunk_size + sizeof(uint_least32_t))), ptr, chunk_size); \ |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
if(unlikely(new_buffer == NULL)) | ||
return NULL; | ||
|
||
memcpy(new_buffer, ptr, min(req_size, (1U << m_area->chk_size_exp) - sizeof(uint_least32_t))); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cppcheck (reported by Codacy) found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
Now it is possible to select between DyMeLoR and the buddy-based memory allocator with a value in the config struct Criticism and suggestions are always welcome! Signed-off-by: Andrea Piccione <piccione@diag.uniroma1.it>
Documentation coverage is 65.3% 👍
|
Criticism and suggestions are always welcome! Signed-off-by: Andrea Piccione <piccione@diag.uniroma1.it>
Criticism and suggestions are always welcome! Signed-off-by: Andrea Piccione <piccione@diag.uniroma1.it>
Documentation coverage is 65.6% 👍
|
Fixed some checkpoint-restore edge cases where we didn't properly cleanup all DyMeLoR areas. The used_mem field is now properly checkpointed and restored as well. Criticism and suggestions are always welcome! Signed-off-by: Andrea Piccione <piccione@diag.uniroma1.it>
Documentation coverage is 65.6% 👍
|
struct dymelor_area *area = *next_area_p; | ||
area->alloc_chunks = ckpt->chunk_cnt; | ||
size_t bitmap_size = bitmap_required_size(num_chunks); | ||
memcpy(area->use_bitmap, ckpt->data, bitmap_size); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
do { | ||
area->alloc_chunks = ckpt->chunk_cnt; | ||
size_t bitmap_size = bitmap_required_size(num_chunks); | ||
memcpy(area->use_bitmap, ckpt->data, bitmap_size); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
ckpt->i = i; | ||
ckpt->chunk_cnt = area->alloc_chunks; | ||
size_t bitmap_size = bitmap_required_size(num_chunks); | ||
memcpy(ckpt->data, area->use_bitmap, bitmap_size); |
Check notice
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
Documentation coverage is 65.9% 👍
|
Documentation coverage is 66.1% 👍
|
This PR reintroduces a rewritten version of the old memory allocator used in RS2 in the codebase.
From a limited evaluation this allocator seems to be often faster than the buddy-based one, even if it's a bit more memory intensive.
A huge problem of this PR is how to select of the memory allocator: I hope we can have a useful discussion about this.