简体   繁体   中英

Pages returned by alloc_pages Linux Kernel

  • 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?
  • 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?

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() allocate pages both for kernel and user space, depends on who's calling it. Pages used by user space.If it is anonymous(user stack or heap) page, then it can be swapped out.

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?

Not necessary.You have to specify a flag tell alloc_pages() what kind of pages you want(eg.__GFP_DMA or __GFP_DMA32 for dma address).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM