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

env: Reserve spdk_malloc/zmalloc/realloc/free for posix env. #148

Closed
wants to merge 1 commit into from

Conversation

@johnmeneghini
Copy link
Contributor

johnmeneghini commented Apr 25, 2017

  • rename spdk_malloc to spdk_aligned_malloc
  • rename spdk_zmalloc to spdk_aligned_zmalloc
  • rename spdk_realloc to spdk_aligned_realloc
  • rename spdk_free to spdk_aligned_free

These APIs should be used for abstracting POSIX malloc, etc.
routines.

  - rename spdk_malloc to spdk_aligned_malloc
  - rename spdk_zmalloc to spdk_aligned_zmalloc
  - rename spdk_realloc to spdk_aligned_realloc
  - rename spdk_free to spdk_aligned_free

  These APIs should be used for abstracting POSIX malloc, etc.
  routines.
Copy link
Member

jimharris left a comment

Hi John,

Can you describe why aligned needs to be added? Do you envision a separate set of these APIs for unaligned allocations?

-Jim

@ghost
Copy link

ghost commented Apr 26, 2017

In addition to Jim's question, if the intent is that the "aligned" functions are equivalent to rte_malloc() whereas the non-aligned ones are equivalent to malloc(), maybe a better distinction would be that the rte_malloc() equivalent version should be used for memory that can be a DMA target (and is registered for spdk_vtophys() translation).

@ranjitnoronha
Copy link

ranjitnoronha commented Apr 26, 2017

My take on this is that we should include the word dma somewhere in the name instead of aligned (spdk_dma_zmalloc()?), since rte_malloc() and its derivatives are returning device addressable or pinned memory.

If for some reason, we are using pinned memory in SPDK, when unpinned memory should suffice (ie. non-I/O related allocations or ordinary data structures), we should replace those calls to spdk_malloc() with regular mallocs(), to avoid demands on a relatively scarce resource.

I did see a commit a few weeks ago replacing some instances of spdk_malloc() with malloc(). Did we catch all such occurrences or do we need a re-review?

Apologizes if this is duplicating conversations elsewhere that I may have missed.

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 26, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 26, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 26, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 28, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 28, 2017

@ghost
Copy link

ghost commented Apr 28, 2017

I would prefer spdk_dma_ over spdk_aligned_ for the rte_malloc() family of wrappers.

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 28, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented Apr 28, 2017

@johnmeneghini
Copy link
Contributor Author

johnmeneghini commented May 3, 2017

This pull request has been replaced by #152
I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.