Rev 4559 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3262 | Serge | 1 | #ifndef _LINUX_MM_H |
2 | #define _LINUX_MM_H |
||
3243 | Serge | 3 | |
5270 | serge | 4 | #include |
3262 | Serge | 5 | |
6 | #define VM_NORESERVE 0x00200000 |
||
3747 | Serge | 7 | |
8 | #define nth_page(page,n) ((void*)(((page_to_phys(page)>>12)+(n))<<12)) |
||
9 | |||
5270 | serge | 10 | #define __page_to_pfn(page) (page_to_phys(page)>>12) |
3747 | Serge | 11 | |
12 | /* to align the pointer to the (next) page boundary */ |
||
3262 | Serge | 13 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) |
14 | |||
4559 | Serge | 15 | /* |
16 | * These are the virtual MM functions - opening of an area, closing and |
||
17 | * unmapping it (needed to keep files on disk up-to-date etc), pointer |
||
18 | * to the functions called when a no-page or a wp-page exception occurs. |
||
19 | */ |
||
20 | struct vm_operations_struct { |
||
21 | void (*open)(struct vm_area_struct * area); |
||
22 | void (*close)(struct vm_area_struct * area); |
||
23 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); |
||
24 | |||
25 | /* notification that a previously read-only page is about to become |
||
26 | * writable, if an error is returned it will cause a SIGBUS */ |
||
27 | int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf); |
||
28 | |||
29 | /* called by access_process_vm when get_user_pages() fails, typically |
||
30 | * for use by special VMAs that can switch between memory and hardware |
||
31 | */ |
||
32 | int (*access)(struct vm_area_struct *vma, unsigned long addr, |
||
33 | void *buf, int len, int write); |
||
34 | #ifdef CONFIG_NUMA |
||
35 | /* |
||
36 | * set_policy() op must add a reference to any non-NULL @new mempolicy |
||
37 | * to hold the policy upon return. Caller should pass NULL @new to |
||
38 | * remove a policy and fall back to surrounding context--i.e. do not |
||
39 | * install a MPOL_DEFAULT policy, nor the task or system default |
||
40 | * mempolicy. |
||
41 | */ |
||
42 | int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); |
||
43 | |||
44 | /* |
||
45 | * get_policy() op must add reference [mpol_get()] to any policy at |
||
46 | * (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure |
||
47 | * in mm/mempolicy.c will do this automatically. |
||
48 | * get_policy() must NOT add a ref if the policy at (vma,addr) is not |
||
49 | * marked as MPOL_SHARED. vma policies are protected by the mmap_sem. |
||
50 | * If no [shared/vma] mempolicy exists at the addr, get_policy() op |
||
51 | * must return NULL--i.e., do not "fallback" to task or system default |
||
52 | * policy. |
||
53 | */ |
||
54 | struct mempolicy *(*get_policy)(struct vm_area_struct *vma, |
||
55 | unsigned long addr); |
||
56 | int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, |
||
57 | const nodemask_t *to, unsigned long flags); |
||
58 | #endif |
||
59 | /* called by sys_remap_file_pages() to populate non-linear mapping */ |
||
60 | int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr, |
||
61 | unsigned long size, pgoff_t pgoff); |
||
62 | }; |
||
4370 | Serge | 63 | #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) |
64 | |||
3262 | Serge | 65 | #endif12)) |