本文介绍了NUMA感知的Linux共享存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows API提供了CreateFileMappingNuma函数( http://msdn.microsoft.com/en-us/library/windows/desktop/aa366539(v = vs.85).aspx )在特定的NUMA节点上创建命名的共享内存空间

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.

到目前为止,我还没有找到Linux的等效功能.

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

我当前的方法如下:

  1. 分配命名共享内存(使用shm_open(...))
  2. 确定当前的NUMA节点(使用numa_move_pages(...))
  3. 将页面移动到目标节点(再次使用numa_move_pages(...))

有人知道更好的方法吗?

Does anyone know a better approach?

记录:我建议的实现确实按预期工作!

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

推荐答案

听起来不错.请注意,在您调用shm_open()/fruncate()时没有分配页面(不要忘记ftruncate()来设置大小!).内核仅创建了vma,并等待将来的代码访问以将页面故障转移到物理内存中.因此,在这种状态下调用numa_move_pages()大概会产生在相关NUMA节点中创建和填充新页面的作用.

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.

这篇关于NUMA感知的Linux共享存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 16:55