firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

refactor: use slab for user_data instead of box

Open ihciah opened this issue 3 years ago • 0 comments

  1. use slab for user_data instead of box Use a Vec based slab is more efficient than using box which may allocate memory.
  2. move generic type from push/pop to IoUring struct Put generic type on push and pop may cause developers misuse it since current user_data is a pointer, and the type should be the same. Since we always use the same user_data type for an IoUring instance, I move the generic to the IoUring struct.

Some PR detail, doc and code maybe incompleted now and will be refined later.

Signed-off-by: ihciah [email protected]

Reason for This PR

[Author TODO: add issue #.] [Open the PR after the related issue has a clear conclusion.] [If there is no issue which states the need for this PR, create one first.] Fixes #

Description of Changes

[Author TODO: add description of changes.]

  • [ ] This functionality can be added in rust-vmm.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

PR Checklist

[Author TODO: Meet these criteria.] [Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • [ ] All commits in this PR are signed (git commit -s).
  • [ ] The issue which led to this PR has a clear conclusion.
  • [ ] This PR follows the solution outlined in the related issue.
  • [ ] The description of changes is clear and encompassing.
  • [ ] Any required documentation changes (code and docs) are included in this PR.
  • [ ] Any newly added unsafe code is properly documented.
  • [ ] Any API changes follow the Runbook for Firecracker API changes.
  • [ ] Any user-facing changes are mentioned in CHANGELOG.md.
  • [ ] All added/changed functionality is tested.

ihciah avatar Aug 21 '22 18:08 ihciah