Skip to content
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

Add MVP code for shared mempool and its example program #261

Closed

Conversation

leonmatt
Copy link
Contributor

This PR will add basic shared mempool code to the mempool library and targets issue #221 .

The way that this works is we mmap a region of shared memory in multiple processes at the same virtual address in each process and then we store all of the required mempool data structures in the region.

To test the program, build the repo, copy the run_proc.sh script from examples/shared_mempool into the build directory's shared_mempool artifacts, and then run "sudo ./run_proc.sh". The example should print out the addresses of the data structs of the mempool.

Next steps are to decide if we want to convert the pointers to offsets for AF_XDP and if we want to build out lockless rings within the mempool data.

Matthew Leon added 7 commits January 10, 2023 20:38
This commit will add basic infrastructure code
for share mempools

Signed-off-by: Matthew Leon <[email protected]>
This commit will add shared mempool teardown code
along with cleaning the shared mempool initialization code

Signed-off-by: Matthew Leon <[email protected]>
    This commit changes the shareable mempool code so that all of the
    structures are contained within the shared memory region along with
    the mempool ring and this commit adds the testing code used to test
    the shared mempool

Signed-off-by: Matthew Leon <[email protected]>
This commit adds a hardcoded address for the shared mempool within the process address
space and adds a script that will disable ASLR so we can increase the likelihood
that mmap succeeds.

Signed-off-by: Matthew Leon <[email protected]>
This commit will clean up the shared mempool example code
and conform it to the standards of the project

Signed-off-by: Matthew Leon <[email protected]>
This commit will clean up the shared mempool code for the linter

Signed-off-by: Matthew Leon <[email protected]>
This commit adds the semaphore unlinking that is needed in
the shared mempool teardown code

Signed-off-by: Matthew Leon <[email protected]>
@KeithWiles KeithWiles marked this pull request as draft January 19, 2023 22:36
@KeithWiles
Copy link
Contributor

@leonmatt this PR is getting out of date. I was thinking we can close this one and open it later if we need too. What do you think?

@leonmatt
Copy link
Contributor Author

leonmatt commented Oct 6, 2023

@KeithWiles I agree. Perhaps if I find spare cycles, we can continue working on this in the future. In case someone picks this up in the future, I think we decided that it might be worthwhile to try placing the shared memory pool in the kernel address space, marking the memory pages r/w and accessible in User-Mode, and then writing a module that creates a memory policy so that the memory pool is only mapped into processes that CNDP is configured to have access.

@leonmatt leonmatt closed this Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants