2013-02-23 13:41:48 +04:00
|
|
|
#ifndef _LINUX_MM_H
|
|
|
|
#define _LINUX_MM_H
|
2013-02-13 12:23:54 +04:00
|
|
|
|
2014-12-27 18:42:08 +03:00
|
|
|
#include <linux/errno.h>
|
2013-02-23 13:41:48 +04:00
|
|
|
|
|
|
|
#define VM_NORESERVE 0x00200000
|
2013-07-02 20:05:26 +04:00
|
|
|
|
|
|
|
#define nth_page(page,n) ((void*)(((page_to_phys(page)>>12)+(n))<<12))
|
|
|
|
|
2014-12-27 18:42:08 +03:00
|
|
|
#define __page_to_pfn(page) (page_to_phys(page)>>12)
|
2013-07-02 20:05:26 +04:00
|
|
|
|
|
|
|
/* to align the pointer to the (next) page boundary */
|
2013-02-23 13:41:48 +04:00
|
|
|
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
|
|
|
|
|
2014-02-06 10:52:49 +04:00
|
|
|
/*
|
|
|
|
* These are the virtual MM functions - opening of an area, closing and
|
|
|
|
* unmapping it (needed to keep files on disk up-to-date etc), pointer
|
|
|
|
* to the functions called when a no-page or a wp-page exception occurs.
|
|
|
|
*/
|
|
|
|
struct vm_operations_struct {
|
|
|
|
void (*open)(struct vm_area_struct * area);
|
|
|
|
void (*close)(struct vm_area_struct * area);
|
|
|
|
int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
|
|
|
|
|
|
|
|
/* notification that a previously read-only page is about to become
|
|
|
|
* writable, if an error is returned it will cause a SIGBUS */
|
|
|
|
int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
|
|
|
|
|
|
|
|
/* called by access_process_vm when get_user_pages() fails, typically
|
|
|
|
* for use by special VMAs that can switch between memory and hardware
|
|
|
|
*/
|
|
|
|
int (*access)(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
void *buf, int len, int write);
|
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
/*
|
|
|
|
* set_policy() op must add a reference to any non-NULL @new mempolicy
|
|
|
|
* to hold the policy upon return. Caller should pass NULL @new to
|
|
|
|
* remove a policy and fall back to surrounding context--i.e. do not
|
|
|
|
* install a MPOL_DEFAULT policy, nor the task or system default
|
|
|
|
* mempolicy.
|
|
|
|
*/
|
|
|
|
int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* get_policy() op must add reference [mpol_get()] to any policy at
|
|
|
|
* (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure
|
|
|
|
* in mm/mempolicy.c will do this automatically.
|
|
|
|
* get_policy() must NOT add a ref if the policy at (vma,addr) is not
|
|
|
|
* marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
|
|
|
|
* If no [shared/vma] mempolicy exists at the addr, get_policy() op
|
|
|
|
* must return NULL--i.e., do not "fallback" to task or system default
|
|
|
|
* policy.
|
|
|
|
*/
|
|
|
|
struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
|
|
|
|
unsigned long addr);
|
|
|
|
int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
|
|
|
|
const nodemask_t *to, unsigned long flags);
|
|
|
|
#endif
|
|
|
|
/* called by sys_remap_file_pages() to populate non-linear mapping */
|
|
|
|
int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
unsigned long size, pgoff_t pgoff);
|
|
|
|
};
|
2013-12-17 10:10:28 +04:00
|
|
|
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
|
|
|
|
|
2016-02-27 23:06:12 +03:00
|
|
|
|
|
|
|
static inline int set_page_dirty(struct page *page)
|
|
|
|
{ return 0; };
|
|
|
|
|
2013-02-23 13:41:48 +04:00
|
|
|
#endif
|