-
Notifications
You must be signed in to change notification settings - Fork 117
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
[catnip] Bad Scatter-Gather Allocation/Free #82
Conversation
tests/sga.rs
Outdated
//============================================================================== | ||
|
||
/// Size of scatter-gather arrays. | ||
const SGA_MAX_SIZE: usize = 1280; |
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.
Might we want to test allocating different sizes, instead of always the same size?
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.
Nice! I've added tests for 64-byte SGA arrays, to cover the heap-allocated buffers in catnip. Also, as we've discussed, I'll add even more comprehensive tests after I'm done with the re-architecting of this memory management component.
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.
This is great, thanks!
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.
Looks good now.
Description
This PR fixes issue #51.
In summary, the pointer arithmetic used for releasing allocated
mbufs
is bad. Instead of relying on this technique, I simply changed current code to use the returnedmbuf
pointer.Since the management of DPDK buffers is not well design, I've also placed a warning, so that we know when we are relying on this allocation strategy.
Finally, I introduce unit-tests that ensure that the current logic works as expected.
This component will be strongly re-architected in a next PR.