Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
memory-failure.c File Reference
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/page-flags.h>
#include <linux/kernel-page-flags.h>
#include <linux/sched.h>
#include <linux/ksm.h>
#include <linux/rmap.h>
#include <linux/export.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
#include <linux/backing-dev.h>
#include <linux/migrate.h>
#include <linux/page-isolation.h>
#include <linux/suspend.h>
#include <linux/slab.h>
#include <linux/swapops.h>
#include <linux/hugetlb.h>
#include <linux/memory_hotplug.h>
#include <linux/mm_inline.h>
#include <linux/kfifo.h>
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  to_kill
 
struct  page_state
 
struct  memory_failure_entry
 
struct  memory_failure_cpu
 

Macros

#define dirty   (1UL << PG_dirty)
 
#define sc   (1UL << PG_swapcache)
 
#define unevict   (1UL << PG_unevictable)
 
#define mlock   (1UL << PG_mlocked)
 
#define writeback   (1UL << PG_writeback)
 
#define lru   (1UL << PG_lru)
 
#define swapbacked   (1UL << PG_swapbacked)
 
#define head   (1UL << PG_head)
 
#define tail   (1UL << PG_tail)
 
#define compound   (1UL << PG_compound)
 
#define slab   (1UL << PG_slab)
 
#define reserved   (1UL << PG_reserved)
 
#define MEMORY_FAILURE_FIFO_ORDER   4
 
#define MEMORY_FAILURE_FIFO_SIZE   (1 << MEMORY_FAILURE_FIFO_ORDER)
 

Enumerations

enum  outcome { IGNORED, FAILED, DELAYED, RECOVERED }
 

Functions

int hwpoison_filter (struct page *p)
 
 EXPORT_SYMBOL_GPL (hwpoison_filter)
 
void shake_page (struct page *p, int access)
 
 EXPORT_SYMBOL_GPL (shake_page)
 
int memory_failure (unsigned long pfn, int trapno, int flags)
 
 EXPORT_SYMBOL_GPL (memory_failure)
 
void memory_failure_queue (unsigned long pfn, int trapno, int flags)
 
 EXPORT_SYMBOL_GPL (memory_failure_queue)
 
 core_initcall (memory_failure_init)
 
int unpoison_memory (unsigned long pfn)
 
 EXPORT_SYMBOL (unpoison_memory)
 
int soft_offline_page (struct page *page, int flags)
 

Variables

int
sysctl_memory_failure_early_kill 
__read_mostly = 0
 

Macro Definition Documentation

#define compound   (1UL << PG_compound)

Definition at line 754 of file memory-failure.c.

#define dirty   (1UL << PG_dirty)

Definition at line 745 of file memory-failure.c.

__u16 head   (1UL << PG_head)

Definition at line 752 of file memory-failure.c.

#define lru   (1UL << PG_lru)

Definition at line 750 of file memory-failure.c.

#define MEMORY_FAILURE_FIFO_ORDER   4

Definition at line 1191 of file memory-failure.c.

#define MEMORY_FAILURE_FIFO_SIZE   (1 << MEMORY_FAILURE_FIFO_ORDER)

Definition at line 1192 of file memory-failure.c.

#define mlock   (1UL << PG_mlocked)

Definition at line 748 of file memory-failure.c.

unsigned char reserved   (1UL << PG_reserved)

Definition at line 756 of file memory-failure.c.

#define sc   (1UL << PG_swapcache)

Definition at line 746 of file memory-failure.c.

#define slab   (1UL << PG_slab)

Definition at line 755 of file memory-failure.c.

#define swapbacked   (1UL << PG_swapbacked)

Definition at line 751 of file memory-failure.c.

#define tail   (1UL << PG_tail)

Definition at line 753 of file memory-failure.c.

#define unevict   (1UL << PG_unevictable)

Definition at line 747 of file memory-failure.c.

#define writeback   (1UL << PG_writeback)

Definition at line 749 of file memory-failure.c.

Enumeration Type Documentation

enum outcome
Enumerator:
IGNORED 
FAILED 
DELAYED 
RECOVERED 

Definition at line 491 of file memory-failure.c.

Function Documentation

core_initcall ( memory_failure_init  )
EXPORT_SYMBOL ( unpoison_memory  )
EXPORT_SYMBOL_GPL ( hwpoison_filter  )
EXPORT_SYMBOL_GPL ( shake_page  )
EXPORT_SYMBOL_GPL ( memory_failure  )
EXPORT_SYMBOL_GPL ( memory_failure_queue  )
int hwpoison_filter ( struct page p)

Definition at line 181 of file memory-failure.c.

int memory_failure ( unsigned long  pfn,
int  trapno,
int  flags 
)

memory_failure - Handle memory failure of a page. : Page Number of the corrupted page : Trap number reported in the signal to user space. : fine tune action taken

This function is called by the low level machine check code of an architecture when it detects hardware memory corruption of a page. It tries its best to recover, which includes dropping pages, killing processes etc.

The function is primarily of use for corruptions that happen outside the current execution context (e.g. when detected by a background scrubber)

Must run in process context (e.g. a work queue) with interrupts enabled and no spinlocks hold.

Definition at line 1017 of file memory-failure.c.

void memory_failure_queue ( unsigned long  pfn,
int  trapno,
int  flags 
)

memory_failure_queue - Schedule handling memory failure of a page. : Page Number of the corrupted page : Trap number reported in the signal to user space. : Flags for memory failure handling

This function is called by the low level hardware error handler when it detects hardware memory corruption of a page. It schedules the recovering of error page, including dropping pages, killing processes etc.

The function is primarily of use for corruptions that happen outside the current execution context (e.g. when detected by a background scrubber)

Can run in IRQ context.

Definition at line 1226 of file memory-failure.c.

void shake_page ( struct page p,
int  access 
)

Definition at line 234 of file memory-failure.c.

int soft_offline_page ( struct page page,
int  flags 
)

Definition at line 1475 of file memory-failure.c.

int unpoison_memory ( unsigned long  pfn)

unpoison_memory - Unpoison a previously poisoned page : Page number of the to be unpoisoned page

Software-unpoison a page that has been poisoned by memory_failure() earlier.

This is only done on the software-level, so it only works for linux injected failures, not real hardware failures

Returns 0 for success, otherwise -errno.

Definition at line 1294 of file memory-failure.c.

Variable Documentation

atomic_long_t mce_bad_pages __read_mostly = 0

Definition at line 60 of file memory-failure.c.