linux - alloc_pages Linux 内核返回的页面

标签 linux memory linux-kernel

  • 是否在内核中使用 alloc_pages 分配了页面,是否也映射供用户使用(如果相关),确保固定并且不会换出到磁盘?
  • alloc_pages函数返回的页面地址是dma地址吗?也就是说,它是否与硬件设备可以通过 dma 访问的地址类型相同?

最佳答案

Are pages allocated using alloc_pages in kernel, also mapped for user use if that's relevant, ensured to be pinned and will not be swapped out to disk?

alloc_pages() 为内核空间和用户空间分配页面,取决于调用它的人。用户空间使用的页面。如果是匿名(用户堆栈或堆)页面,则可以将其换出。

Is the page's address returned by alloc_pages function is dma address? that is, is it the same address type that hardware device could access through the dma?

没有必要。你必须指定一个标志告诉 alloc_pages() 你想要什么样的页面(例如 __GFP_DMA 或 __GFP_DMA32 用于 dma 地址)。

关于linux - alloc_pages Linux 内核返回的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38092715/

相关文章:

c - linux下c语言的socket编程

linux - 如何将可选文件添加到 Makefile

python - 如何循环整个 python 脚本以及每次运行更改顺序

javascript - 如何在 DOM 树显示在屏幕上之前对其进行操作? (javascript, jquery, ...)

php - 实时识别爬虫 - PHP - 跟踪内存中的访问文件

linux - 检测用户空间模块是否从 Linux 驱动程序意外死亡

c++ - 如何使用我自己的库 C++ ubuntu

java - 这是在 java 中进行深度复制以进行内存基准测试的正确方法吗?

c - 如何反转 spin_lock_init

c - 如何在内核模块的相同偏移量中预留内存