NUMA-aware named shared memory for Linux

点点圈 提交于 2019-12-22 06:29:07

问题


The Windows API offers the CreateFileMappingNuma function (http://msdn.microsoft.com/en-us/library/windows/desktop/aa366539(v=vs.85).aspx) to create a named shared memory space on a specific NUMA node.

So far, I have not found an equivalent function for Linux.

My current approach looks like this:

  1. Allocate named shared memory (using shm_open(...))
  2. Determine current NUMA node (using numa_move_pages(...))
  3. Move pages to target Node (using numa_move_pages(...) again)

Does anyone know a better approach?

EDIT: For the record: My proposed implementation does work as expected!


回答1:


That sounds right. Note that there are no pages allocated at the point where you call shm_open()/fruncate() (don't forget ftruncate() to set the size!). The kernel simply creates the vma and waits for future code accesses to fault the pages into physical memory. So calling numa_move_pages() in this state will presumably have the effect of creating and populating new pages in the relevant NUMA nodes.



来源:https://stackoverflow.com/questions/11962018/numa-aware-named-shared-memory-for-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!