- 是否在内核中使用
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/