申请和device不再同一个numa节点的memory
来源:互联网 发布:java 如何加密 编辑:程序博客网 时间:2024/06/03 05:09
如下所示device结构体有一个numa_node 表示当前device所在的numa节点。struct device {struct device*parent;struct device_private*p;struct kobject kobj;const char*init_name; /* initial name of the device */const struct device_type *type;#ifdef CONFIG_NUMAintnuma_node;/* NUMA node this device is close to */#endif}因此一般通过dma_zalloc_coherent等函数申请memory的时候也就会在这个numa节点上申请内存,但是有时候当前节点没有足够的内存,就可以制定和device不同的节点来申请内存.如下例所示:通过dma_zalloc_coherent 申请的memory就和当前device 不再同一个numa节点上static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, size_t size, dma_addr_t *dma_handle, int node){struct mlx5_priv *priv = &dev->priv;int original_node;void *cpu_handle;mutex_lock(&priv->alloc_mutex);//通过dev_to_node的到当前的numa节点并保存到original_nodeoriginal_node = dev_to_node(&dev->pdev->dev);//设置要申请numa节点set_dev_node(&dev->pdev->dev, node);cpu_handle = dma_zalloc_coherent(&dev->pdev->dev, size, dma_handle, GFP_KERNEL);//restore原本的numa节点set_dev_node(&dev->pdev->dev, original_node);mutex_unlock(&priv->alloc_mutex);return cpu_handle;}其中dev_to_node和set_dev_node的源码如下,可见就是操作#ifdef CONFIG_NUMAstatic inline int dev_to_node(struct device *dev){return dev->numa_node;}static inline void set_dev_node(struct device *dev, int node){dev->numa_node = node;}#elsestatic inline int dev_to_node(struct device *dev){return -1;}static inline void set_dev_node(struct device *dev, int node){}#endif
阅读全文
0 0
- 申请和device不再同一个numa节点的memory
- numa的内存按节点分配和线程绑定
- device的私有memory
- NUMA节点的使用顺序配置
- acpi的_PXM 表示device所在的numa id
- NUMA memory access latency benchmark
- Memory Device: GUI_MEMDEV_Select()的应用之一
- 测试cuda的unified memory和cudaMemcpy的加减乘除及空间申请时间对比
- NUMA (Non- Uniform Memory Access Architecture)
- NUMA (non-uniform memory access) and vNUMA
- How NUMA Allocates Memory (文档 ID 780466.1)
- numa,numa node 和物理内存
- VS20005, Smart device vc++ , 不再支持的类
- NUMA和Mongodb
- 关于cpu和numa
- SQLServer 和numa
- 关于memory device context内存设备上下文和位图
- ROS 基础: 在同一个节点里订阅和发布消息
- js 格式化货币
- 嵌入式u-boot浅析
- JVM GC算法
- 正则验证手机号和电话号码
- 使用github详细介绍
- 申请和device不再同一个numa节点的memory
- ES6学习笔记---二进制数组(概念)
- Ubuntu 设置mysql 远程访问
- lodash difference 函数demo
- js中必须用分号的地方——由一个题目引起的思考
- SpringMVC配置及简单应用
- git commit
- LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal
- Java 包与接口、抽象类速记