Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
swap_state.c File Reference
#include <linux/mm.h>
#include <linux/gfp.h>
#include <linux/kernel_stat.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/init.h>
#include <linux/pagemap.h>
#include <linux/backing-dev.h>
#include <linux/blkdev.h>
#include <linux/pagevec.h>
#include <linux/migrate.h>
#include <linux/page_cgroup.h>
#include <asm/pgtable.h>

Go to the source code of this file.

Macros

#define INC_CACHE_INFO(x)   do { swap_cache_info.x++; } while (0)
 

Functions

void show_swap_cache_info (void)
 
int add_to_swap_cache (struct page *page, swp_entry_t entry, gfp_t gfp_mask)
 
void __delete_from_swap_cache (struct page *page)
 
int add_to_swap (struct page *page)
 
void delete_from_swap_cache (struct page *page)
 
void free_page_and_swap_cache (struct page *page)
 
void free_pages_and_swap_cache (struct page **pages, int nr)
 
struct pagelookup_swap_cache (swp_entry_t entry)
 
struct pageread_swap_cache_async (swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr)
 
struct pageswapin_readahead (swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr)
 

Variables

struct address_space swapper_space
 

Macro Definition Documentation

#define INC_CACHE_INFO (   x)    do { swap_cache_info.x++; } while (0)

Definition at line 47 of file swap_state.c.

Function Documentation

void __delete_from_swap_cache ( struct page page)

Definition at line 123 of file swap_state.c.

int add_to_swap ( struct page page)

Definition at line 144 of file swap_state.c.

int add_to_swap_cache ( struct page page,
swp_entry_t  entry,
gfp_t  gfp_mask 
)

Definition at line 107 of file swap_state.c.

void delete_from_swap_cache ( struct page page)

Definition at line 195 of file swap_state.c.

void free_page_and_swap_cache ( struct page page)

Definition at line 229 of file swap_state.c.

void free_pages_and_swap_cache ( struct page **  pages,
int  nr 
)

Definition at line 239 of file swap_state.c.

struct page* lookup_swap_cache ( swp_entry_t  entry)
read

Definition at line 262 of file swap_state.c.

struct page* read_swap_cache_async ( swp_entry_t  entry,
gfp_t  gfp_mask,
struct vm_area_struct vma,
unsigned long  addr 
)
read

Definition at line 281 of file swap_state.c.

void show_swap_cache_info ( void  )

Definition at line 56 of file swap_state.c.

struct page* swapin_readahead ( swp_entry_t  entry,
gfp_t  gfp_mask,
struct vm_area_struct vma,
unsigned long  addr 
)
read

swapin_readahead - swap in pages in hope we need them soon : swap entry of this memory : memory allocation flags : user vma this address belongs to : target address for mempolicy

Returns the struct page for entry and addr, after queueing swapin.

Primitive swap readahead code. We simply read an aligned block of (1 << page_cluster) entries in the swap area. This method is chosen because it doesn't cost us any seek time. We also make sure to queue the 'original' request together with the readahead ones...

This has been extended to use the NUMA policies from the mm triggering the readahead.

Caller must hold down_read on the vma->vm_mm if vma is not NULL.

Definition at line 373 of file swap_state.c.

Variable Documentation

unsigned long add_total

Definition at line 50 of file swap_state.c.

unsigned long del_total

Definition at line 51 of file swap_state.c.

unsigned long find_success

Definition at line 52 of file swap_state.c.

unsigned long find_total

Definition at line 53 of file swap_state.c.

struct address_space swapper_space
Initial value:
= {
.tree_lock = __SPIN_LOCK_UNLOCKED(swapper_space.tree_lock),
.a_ops = &swap_aops,
.i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
.backing_dev_info = &swap_backing_dev_info,
}

Definition at line 39 of file swap_state.c.