Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
mempolicy.c File Reference
#include <linux/mempolicy.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/hugetlb.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/nodemask.h>
#include <linux/cpuset.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/export.h>
#include <linux/nsproxy.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/compat.h>
#include <linux/swap.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/migrate.h>
#include <linux/ksm.h>
#include <linux/rmap.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/ctype.h>
#include <linux/mm_inline.h>
#include <asm/tlbflush.h>
#include <asm/uaccess.h>
#include <linux/random.h>
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  mempolicy_operations
 

Macros

#define MPOL_MF_DISCONTIG_OK   (MPOL_MF_INTERNAL << 0) /* Skip checks for continuous vmas */
 
#define MPOL_MF_INVERT   (MPOL_MF_INTERNAL << 1) /* Invert check for nodemask */
 
#define MPOL_LOCAL   MPOL_MAX
 

Functions

void __mpol_put (struct mempolicy *p)
 
void mpol_rebind_task (struct task_struct *tsk, const nodemask_t *new, enum mpol_rebind_step step)
 
void mpol_rebind_mm (struct mm_struct *mm, nodemask_t *new)
 
void mpol_fix_fork_child_flag (struct task_struct *p)
 
int do_migrate_pages (struct mm_struct *mm, const nodemask_t *from, const nodemask_t *to, int flags)
 
 SYSCALL_DEFINE6 (mbind, unsigned long, start, unsigned long, len, unsigned long, mode, unsigned long __user *, nmask, unsigned long, maxnode, unsigned, flags)
 
 SYSCALL_DEFINE3 (set_mempolicy, int, mode, unsigned long __user *, nmask, unsigned long, maxnode)
 
 SYSCALL_DEFINE4 (migrate_pages, pid_t, pid, unsigned long, maxnode, const unsigned long __user *, old_nodes, const unsigned long __user *, new_nodes)
 
 SYSCALL_DEFINE5 (get_mempolicy, int __user *, policy, unsigned long __user *, nmask, unsigned long, maxnode, unsigned long, addr, unsigned long, flags)
 
struct mempolicyget_vma_policy (struct task_struct *task, struct vm_area_struct *vma, unsigned long addr)
 
unsigned slab_node (void)
 
int node_random (const nodemask_t *maskp)
 
bool mempolicy_nodemask_intersects (struct task_struct *tsk, const nodemask_t *mask)
 
struct pagealloc_pages_vma (gfp_t gfp, int order, struct vm_area_struct *vma, unsigned long addr, int node)
 
struct pagealloc_pages_current (gfp_t gfp, unsigned order)
 
 EXPORT_SYMBOL (alloc_pages_current)
 
struct mempolicy__mpol_dup (struct mempolicy *old)
 
bool __mpol_equal (struct mempolicy *a, struct mempolicy *b)
 
struct mempolicympol_shared_policy_lookup (struct shared_policy *sp, unsigned long idx)
 
void mpol_shared_policy_init (struct shared_policy *sp, struct mempolicy *mpol)
 
int mpol_set_shared_policy (struct shared_policy *info, struct vm_area_struct *vma, struct mempolicy *npol)
 
void mpol_free_shared_policy (struct shared_policy *p)
 
void __init numa_policy_init (void)
 
void numa_default_policy (void)
 
int mpol_to_str (char *buffer, int maxlen, struct mempolicy *pol, int no_context)
 

Variables

enum zone_type policy_zone = 0
 

Macro Definition Documentation

#define MPOL_LOCAL   MPOL_MAX

Definition at line 2378 of file mempolicy.c.

#define MPOL_MF_DISCONTIG_OK   (MPOL_MF_INTERNAL << 0) /* Skip checks for continuous vmas */

Definition at line 101 of file mempolicy.c.

#define MPOL_MF_INVERT   (MPOL_MF_INTERNAL << 1) /* Invert check for nodemask */

Definition at line 102 of file mempolicy.c.

Function Documentation

struct mempolicy* __mpol_dup ( struct mempolicy old)
read

Definition at line 2012 of file mempolicy.c.

bool __mpol_equal ( struct mempolicy a,
struct mempolicy b 
)

Definition at line 2041 of file mempolicy.c.

void __mpol_put ( struct mempolicy p)

Definition at line 285 of file mempolicy.c.

struct page* alloc_pages_current ( gfp_t  gfp,
unsigned  order 
)
read

alloc_pages_current - Allocate pages.

: GFP_USER user allocation, GFP_KERNEL kernel allocation, GFP_HIGHMEM highmem allocation, GFP_FS don't call back into a file system. GFP_ATOMIC don't sleep. : Power of two of allocation size in pages. 0 is a single page.

Allocate a page from the kernel page pool. When not in interrupt context and apply the current process NUMA policy. Returns NULL when no page can be allocated.

Don't call cpuset_update_task_memory_state() unless 1) it's ok to take cpuset_sem (can WAIT), and 2) allocating for current task (not interrupt).

Definition at line 1970 of file mempolicy.c.

struct page* alloc_pages_vma ( gfp_t  gfp,
int  order,
struct vm_area_struct vma,
unsigned long  addr,
int  node 
)
read

alloc_pages_vma - Allocate a page for a VMA.

: GFP_USER user allocation. GFP_KERNEL kernel allocations, GFP_HIGHMEM highmem/user allocations, GFP_FS allocation should not call back into a file system. GFP_ATOMIC don't sleep.

:Order of the GFP allocation. : Pointer to VMA or NULL if not available. : Virtual Address of the allocation. Must be inside the VMA.

This function allocates a page from the kernel page pool and applies a NUMA policy associated with the VMA or the current process. When VMA is not NULL caller must hold down_read on the mmap_sem of the mm_struct of the VMA to prevent it from going away. Should be used for all allocations for pages that will be mapped into user space. Returns NULL when no page can be allocated.

Should be called with the mm_sem of the vma hold.

Definition at line 1906 of file mempolicy.c.

int do_migrate_pages ( struct mm_struct mm,
const nodemask_t from,
const nodemask_t to,
int  flags 
)

Definition at line 1113 of file mempolicy.c.

EXPORT_SYMBOL ( alloc_pages_current  )
struct mempolicy* get_vma_policy ( struct task_struct task,
struct vm_area_struct vma,
unsigned long  addr 
)
read

Definition at line 1546 of file mempolicy.c.

bool mempolicy_nodemask_intersects ( struct task_struct tsk,
const nodemask_t mask 
)

Definition at line 1833 of file mempolicy.c.

void mpol_fix_fork_child_flag ( struct task_struct p)

Definition at line 720 of file mempolicy.c.

void mpol_free_shared_policy ( struct shared_policy p)

Definition at line 2304 of file mempolicy.c.

void mpol_rebind_mm ( struct mm_struct mm,
nodemask_t new 
)

Definition at line 432 of file mempolicy.c.

void mpol_rebind_task ( struct task_struct tsk,
const nodemask_t new,
enum mpol_rebind_step  step 
)

Definition at line 420 of file mempolicy.c.

int mpol_set_shared_policy ( struct shared_policy info,
struct vm_area_struct vma,
struct mempolicy npol 
)

Definition at line 2279 of file mempolicy.c.

void mpol_shared_policy_init ( struct shared_policy sp,
struct mempolicy mpol 
)

mpol_shared_policy_init - initialize shared policy for inode : pointer to inode shared policy : struct mempolicy to install

Install non-NULL in inode's shared policy rb-tree. On entry, the current task has a reference on a non-NULL . This must be released on exit. This is called at get_inode() calls and we can use GFP_KERNEL.

Definition at line 2240 of file mempolicy.c.

struct mempolicy* mpol_shared_policy_lookup ( struct shared_policy sp,
unsigned long  idx 
)
read

Definition at line 2133 of file mempolicy.c.

int mpol_to_str ( char buffer,
int  maxlen,
struct mempolicy pol,
int  no_context 
)

mpol_to_str - format a mempolicy structure for printing : to contain formatted mempolicy string : length of : pointer to mempolicy to be formatted : "context free" mempolicy - use nodemask in w.user_nodemask

Convert a mempolicy into a string. Returns the number of characters in buffer (if positive) or an error (negative)

Definition at line 2543 of file mempolicy.c.

int node_random ( const nodemask_t maskp)

Definition at line 1726 of file mempolicy.c.

void numa_default_policy ( void  )

Definition at line 2365 of file mempolicy.c.

void __init numa_policy_init ( void  )

Definition at line 2322 of file mempolicy.c.

unsigned slab_node ( void  )

Definition at line 1639 of file mempolicy.c.

SYSCALL_DEFINE3 ( set_mempolicy  ,
int  ,
mode  ,
unsigned long __user ,
nmask  ,
unsigned  long,
maxnode   
)

Definition at line 1310 of file mempolicy.c.

SYSCALL_DEFINE4 ( migrate_pages  ,
pid_t  ,
pid  ,
unsigned  long,
maxnode  ,
const unsigned long __user ,
old_nodes  ,
const unsigned long __user ,
new_nodes   
)

Definition at line 1329 of file mempolicy.c.

SYSCALL_DEFINE5 ( get_mempolicy  ,
int __user ,
policy  ,
unsigned long __user ,
nmask  ,
unsigned  long,
maxnode  ,
unsigned  long,
addr  ,
unsigned  long,
flags   
)

Definition at line 1425 of file mempolicy.c.

SYSCALL_DEFINE6 ( mbind  ,
unsigned  long,
start  ,
unsigned  long,
len  ,
unsigned  long,
mode  ,
unsigned long __user ,
nmask  ,
unsigned  long,
maxnode  ,
unsigned  ,
flags   
)

Definition at line 1288 of file mempolicy.c.

Variable Documentation

enum zone_type policy_zone = 0

Definition at line 109 of file mempolicy.c.