type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/swapops.h>
includes
#include <linux/hugetlb.h>
includes
#include <linux/memory_hotplug.h>
includes
#include <linux/mm_inline.h>
includes
#include <linux/kfifo.h>
defines
#define dirty (1UL << PG_dirty)
defines
#define sc (1UL << PG_swapcache)
defines
#define unevict (1UL << PG_unevictable)
defines
#define mlock (1UL << PG_mlocked)
defines
#define writeback (1UL << PG_writeback)
defines
#define lru (1UL << PG_lru)
defines
#define swapbacked (1UL << PG_swapbacked)
defines
#define head (1UL << PG_head)
defines
#define tail (1UL << PG_tail)
defines
#define compound (1UL << PG_compound)
defines
#define slab (1UL << PG_slab)
defines
#define reserved (1UL << PG_reserved)
defines
#define MEMORY_FAILURE_FIFO_ORDER 4
defines
#define MEMORY_FAILURE_FIFO_SIZE (1 << MEMORY_FAILURE_FIFO_ORDER)
structs
struct to_kill { struct list_head nd; struct task_struct *tsk; unsigned long addr; char addr_valid; };
structs
struct memory_failure_entry { unsigned long pfn; int trapno; int flags; };
structs
struct memory_failure_cpu { DECLARE_KFIFO(fifo, struct memory_failure_entry, MEMORY_FAILURE_FIFO_SIZE); spinlock_t lock; struct work_struct work; };
functions
int hwpoison_filter_dev(struct page *p) { struct address_space *mapping; dev_t dev; if (hwpoison_filter_dev_major == ~0U && hwpoison_filter_dev_minor == ~0U) return 0; /* * page_mapping() does not accept slab pages. */ if (PageSlab(p)) return -EINVAL; mapping = page_mapping(p); if (mapping == NUL...
functions
int hwpoison_filter_flags(struct page *p) { if (!hwpoison_filter_flags_mask) return 0; if ((stable_page_flags(p) & hwpoison_filter_flags_mask) == hwpoison_filter_flags_value) return 0; else return -EINVAL; }
functions
int hwpoison_filter_task(struct page *p) { struct mem_cgroup *mem; struct cgroup_subsys_state *css; unsigned long ino; if (!hwpoison_filter_memcg) return 0; mem = try_get_mem_cgroup_from_page(p); if (!mem) return -EINVAL; css = mem_cgroup_css(mem); /* root_mem_cgroup has NULL dentries */ if (!css->cgrou...
functions
int hwpoison_filter_task(struct page *p) { return 0; }
functions
int hwpoison_filter(struct page *p) { if (!hwpoison_filter_enable) return 0; if (hwpoison_filter_dev(p)) return -EINVAL; if (hwpoison_filter_flags(p)) return -EINVAL; if (hwpoison_filter_task(p)) return -EINVAL; return 0; }
functions
int hwpoison_filter(struct page *p) { return 0; }
functions
int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno, unsigned long pfn, struct page *page) { struct siginfo si; int ret; printk(KERN_ERR "MCE %#lx: Killing %s:%d early due to hardware memory corruption\n", pfn, t->comm, t->pid); si.si_signo = SIGBUS; si.si_errno = 0; si.si_code = BUS_MC...
functions
void shake_page(struct page *p, int access) { if (!PageSlab(p)) { lru_add_drain_all(); if (PageLRU(p)) return; drain_all_pages(); if (PageLRU(p) || is_free_buddy_page(p)) return; }
functions
void add_to_kill(struct task_struct *tsk, struct page *p, struct vm_area_struct *vma, struct list_head *to_kill, struct to_kill **tkc) { struct to_kill *tk; if (*tkc) { tk = *tkc; *tkc = NULL; }
functions
void kill_procs_ao(struct list_head *to_kill, int doit, int trapno, int fail, struct page *page, unsigned long pfn) { struct to_kill *tk, *next; list_for_each_entry_safe (tk, next, to_kill, nd) { if (doit) { /* * In case something went wrong with munmapping * make sure the process doesn't catch the...
functions
int task_early_kill(struct task_struct *tsk) { if (!tsk->mm) return 0; if (tsk->flags & PF_MCE_PROCESS) return !!(tsk->flags & PF_MCE_EARLY); return sysctl_memory_failure_early_kill; }
functions
void collect_procs_anon(struct page *page, struct list_head *to_kill, struct to_kill **tkc) { struct vm_area_struct *vma; struct task_struct *tsk; struct anon_vma *av; av = page_lock_anon_vma(page); if (av == NULL) /* Not actually mapped anymore */ return; read_lock(&tasklist_lock); for_each_process...
functions
void collect_procs_file(struct page *page, struct list_head *to_kill, struct to_kill **tkc) { struct vm_area_struct *vma; struct task_struct *tsk; struct prio_tree_iter iter; struct address_space *mapping = page->mapping; mutex_lock(&mapping->i_mmap_mutex); read_lock(&tasklist_lock); for_each_process(t...
functions
void collect_procs(struct page *page, struct list_head *tokill) { struct to_kill *tk; if (!page->mapping) return; tk = kmalloc(sizeof(struct to_kill), GFP_NOIO); if (!tk) return; if (PageAnon(page)) collect_procs_anon(page, tokill, &tk); else collect_procs_file(page, tokill, &tk); kfree(tk); }
functions
int delete_from_lru_cache(struct page *p) { if (!isolate_lru_page(p)) { /* * Clear sensible page flags, so that the buddy system won't * complain when the page is unpoison-and-freed. */ ClearPageActive(p); ClearPageUnevictable(p); /* * drop the page count elevated by isolate_lru_page() */ page...
functions
int me_kernel(struct page *p, unsigned long pfn) { return IGNORED; }
functions
int me_unknown(struct page *p, unsigned long pfn) { printk(KERN_ERR "MCE %#lx: Unknown page state\n", pfn); return FAILED; }
functions
int me_pagecache_clean(struct page *p, unsigned long pfn) { int err; int ret = FAILED; struct address_space *mapping; delete_from_lru_cache(p); /* * For anonymous pages we're done the only reference left * should be the one m_f() holds. */ if (PageAnon(p)) return RECOVERED; /* * Now truncate the pag...
functions
int me_pagecache_dirty(struct page *p, unsigned long pfn) { struct address_space *mapping = page_mapping(p); SetPageError(p); /* TBD: print more information about the file. */ if (mapping) { /* * IO error will be reported by write(), fsync(), etc. * who check the mapping. * This way the application know...
functions
int me_swapcache_dirty(struct page *p, unsigned long pfn) { ClearPageDirty(p); /* Trigger EIO in shmem: */ ClearPageUptodate(p); if (!delete_from_lru_cache(p)) return DELAYED; else return FAILED; }
functions
int me_swapcache_clean(struct page *p, unsigned long pfn) { delete_from_swap_cache(p); if (!delete_from_lru_cache(p)) return RECOVERED; else return FAILED; }
functions
int me_huge_page(struct page *p, unsigned long pfn) { int res = 0; struct page *hpage = compound_head(p); /* * We can safely recover from error on free or reserved (i.e. * not in-use) hugepage by dequeuing it from freelist. * To check whether a hugepage is in-use or not, we can't use * page->lru because it c...
functions
void action_result(unsigned long pfn, char *msg, int result) { struct page *page = pfn_to_page(pfn); printk(KERN_ERR "MCE %#lx: %s%s page recovery: %s\n", pfn, PageDirty(page) ? "dirty " : "", msg, action_name[result]); }
functions
int page_action(struct page_state *ps, struct page *p, unsigned long pfn) { int result; int count; result = ps->action(p, pfn); action_result(pfn, ps->msg, result); count = page_count(p) - 1; if (ps->action == me_swapcache_dirty && result == DELAYED) count--; if (count != 0) { printk(KERN_ERR "...
functions
int hwpoison_user_mappings(struct page *p, unsigned long pfn, int trapno) { enum ttu_flags ttu = TTU_UNMAP | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; struct address_space *mapping; LIST_HEAD(tokill); int ret; int kill = 1; struct page *hpage = compound_head(p); struct page *ppage; if (PageReserved(p) || Pag...
functions
void set_page_hwpoison_huge_page(struct page *hpage) { int i; int nr_pages = 1 << compound_trans_order(hpage); for (i = 0; i < nr_pages; i++) SetPageHWPoison(hpage + i); }
functions
void clear_page_hwpoison_huge_page(struct page *hpage) { int i; int nr_pages = 1 << compound_trans_order(hpage); for (i = 0; i < nr_pages; i++) ClearPageHWPoison(hpage + i); }
functions
int __memory_failure(unsigned long pfn, int trapno, int flags) { struct page_state *ps; struct page *p; struct page *hpage; int res; unsigned int nr_pages; if (!sysctl_memory_failure_recovery) panic("Memory failure from trap %d on page %lx", trapno, pfn); if (!pfn_valid(pfn)) { printk(KERN_ERR "MC...
functions
void memory_failure(unsigned long pfn, int trapno) { __memory_failure(pfn, trapno, 0); }
functions
void memory_failure_queue(unsigned long pfn, int trapno, int flags) { struct memory_failure_cpu *mf_cpu; unsigned long proc_flags; struct memory_failure_entry entry = { .pfn = pfn, .trapno = trapno, .flags = flags, }
functions
void memory_failure_work_func(struct work_struct *work) { struct memory_failure_cpu *mf_cpu; struct memory_failure_entry entry = { 0, }
functions
__init memory_failure_init(void) { struct memory_failure_cpu *mf_cpu; int cpu; for_each_possible_cpu(cpu) { mf_cpu = &per_cpu(memory_failure_cpu, cpu); spin_lock_init(&mf_cpu->lock); INIT_KFIFO(mf_cpu->fifo); INIT_WORK(&mf_cpu->work, memory_failure_work_func); }
functions
int unpoison_memory(unsigned long pfn) { struct page *page; struct page *p; int freeit = 0; unsigned int nr_pages; if (!pfn_valid(pfn)) return -ENXIO; p = pfn_to_page(pfn); page = compound_head(p); if (!PageHWPoison(p)) { pr_info("MCE: Page was already unpoisoned %#lx\n", pfn); return 0; }
functions
int get_any_page(struct page *p, unsigned long pfn, int flags) { int ret; if (flags & MF_COUNT_INCREASED) return 1; /* * The lock_memory_hotplug prevents a race with memory hotplug. * This is a big hammer, a better would be nicer. */ lock_memory_hotplug(); /* * Isolate the page, so that it doesn't get...
functions
int soft_offline_huge_page(struct page *page, int flags) { int ret; unsigned long pfn = page_to_pfn(page); struct page *hpage = compound_head(page); LIST_HEAD(pagelist); ret = get_any_page(page, pfn, flags); if (ret < 0) return ret; if (ret == 0) goto done; if (PageHWPoison(hpage)) { put_page(hpage); ...
functions
int soft_offline_page(struct page *page, int flags) { int ret; unsigned long pfn = page_to_pfn(page); if (PageHuge(page)) return soft_offline_huge_page(page, flags); ret = get_any_page(page, pfn, flags); if (ret < 0) return ret; if (ret == 0) goto done; /* * Page cache page we can handle? */ if (!P...
functions
DELAY create_delay (int run, int size, double* in, double* out, int rate, double tdelta, double tdelay) { DELAY a = (DELAY) malloc0 (sizeof (delay)); a->run = run; a->size = size; a->in = in; a->out = out; a->rate = rate; a->tdelta = tdelta; a->tdelay = tdelay; a->L = (int)(0.5 + 1.0 / (a->tdelta * (double)a->...
functions
void destroy_delay (DELAY a) { DeleteCriticalSection (&a->cs_update); _aligned_free (a->ring); _aligned_free (a->h); _aligned_free (a); }
functions
void flush_delay (DELAY a) { memset (a->ring, 0, a->cpp * sizeof (complex)); a->idx_in = 0; }
functions
void xdelay (DELAY a) { EnterCriticalSection (&a->cs_update); if (a->run) { int i, j, k, idx, n; double Itmp, Qtmp; for (i = 0; i < a->size; i++) { a->ring[2 * a->idx_in + 0] = a->in[2 * i + 0]; a->ring[2 * a->idx_in + 1] = a->in[2 * i + 1]; Itmp = 0.0; Qtmp = 0.0; if ((n = a->idx_in + a->snum...
functions
void SetDelayRun (DELAY a, int run) { EnterCriticalSection (&a->cs_update); a->run = run; LeaveCriticalSection (&a->cs_update); }
functions
double SetDelayValue (DELAY a, double tdelay) { double adelay; EnterCriticalSection (&a->cs_update); a->tdelay = tdelay; a->phnum = (int)(0.5 + a->tdelay / a->tdelta); a->snum = a->phnum / a->L; a->phnum %= a->L; a->adelay = a->adelta * (a->snum * a->L + a->phnum); adelay = a->adelay; LeaveCriticalSection (&a-...
functions
void SetDelayBuffs (DELAY a, int size, double* in, double* out) { EnterCriticalSection (&a->cs_update); a->size = size; a->in = in; a->out = out; LeaveCriticalSection (&a->cs_update); }
includes
#include <linux/kernel.h>
includes
#include <linux/mm.h>
includes
#include <linux/tty.h>
includes
#include <linux/tty_driver.h>
includes
#include <linux/console.h>
includes
#include <linux/init.h>
includes
#include <linux/jiffies.h>
includes
#include <linux/nmi.h>
includes
#include <linux/module.h>
includes
#include <linux/moduleparam.h>
includes
#include <linux/interrupt.h>
includes
#include <linux/delay.h>
includes
#include <linux/smp.h>
includes
#include <linux/security.h>
includes
#include <linux/bootmem.h>
includes
#include <linux/memblock.h>
includes
#include <linux/syscalls.h>
includes
#include <linux/kexec.h>
includes
#include <linux/kdb.h>
includes
#include <linux/ratelimit.h>
includes
#include <linux/kmsg_dump.h>
includes
#include <linux/syslog.h>
includes
#include <linux/cpu.h>
includes
#include <linux/notifier.h>
includes
#include <linux/rculist.h>
includes
#include <asm/uaccess.h>
includes
#include <mach/msm_rtb.h>
includes
#include <trace/events/printk.h>
defines
#define CREATE_TRACE_POINTS
defines
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
defines
#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL
defines
#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
defines
#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
defines
#define LOG_BUF_MASK (log_buf_len-1)
defines
#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])