1VM_INSERT_PAGE(9) Memory Management in Linux VM_INSERT_PAGE(9)
2
3
4
6 vm_insert_page - insert single page into user vma
7
9 int vm_insert_page(struct vm_area_struct * vma, unsigned long addr,
10 struct page * page);
11
13 vma
14 user vma to map to
15
16 addr
17 target user address of this page
18
19 page
20 source kernel page
21
23 This allows drivers to insert individual pages they've allocated into a
24 user vma.
25
26 The page has to be a nice clean _individual_ kernel allocation. If you
27 allocate a compound page, you need to have marked it as such
28 (__GFP_COMP), or manually just split the page up yourself (see
29 split_page).
30
31 NOTE! Traditionally this was done with “remap_pfn_range” which took an
32 arbitrary page protection parameter. This doesn't allow that. Your vma
33 protection will have to be set up correctly, which means that if you
34 want a shared writable mapping, you'd better ask for a shared writable
35 mapping!
36
37 The page does not need to be reserved.
38
39 Usually this function is called from f_op->mmap handler under
40 mm->mmap_sem write-lock, so it can change vma->vm_flags. Caller must
41 set VM_MIXEDMAP on vma if it wants to call this function from other
42 places, for example from page-fault handler.
43
45Kernel Hackers Manual 3.10 June 2019 VM_INSERT_PAGE(9)