Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions | Variables
oom.h File Reference
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/nodemask.h>
#include <uapi/linux/oom.h>

Go to the source code of this file.




void compare_swap_oom_score_adj (int old_val, int new_val)
int test_set_oom_score_adj (int new_val)
unsigned long oom_badness (struct task_struct *p, struct mem_cgroup *memcg, const nodemask_t *nodemask, unsigned long totalpages)
void oom_kill_process (struct task_struct *p, gfp_t gfp_mask, int order, unsigned int points, unsigned long totalpages, struct mem_cgroup *memcg, nodemask_t *nodemask, const char *message)
int try_set_zonelist_oom (struct zonelist *zonelist, gfp_t gfp_flags)
void clear_zonelist_oom (struct zonelist *zonelist, gfp_t gfp_flags)
void check_panic_on_oom (enum oom_constraint constraint, gfp_t gfp_mask, int order, const nodemask_t *nodemask)
enum oom_scan_t oom_scan_process_thread (struct task_struct *task, unsigned long totalpages, const nodemask_t *nodemask, bool force_kill)
void mem_cgroup_out_of_memory (struct mem_cgroup *memcg, gfp_t gfp_mask, int order)
void out_of_memory (struct zonelist *zonelist, gfp_t gfp_mask, int order, nodemask_t *mask, bool force_kill)
int register_oom_notifier (struct notifier_block *nb)
int unregister_oom_notifier (struct notifier_block *nb)
struct task_structfind_lock_task_mm (struct task_struct *p)


bool oom_killer_disabled
int sysctl_oom_dump_tasks
int sysctl_oom_kill_allocating_task
int sysctl_panic_on_oom

Enumeration Type Documentation


Definition at line 18 of file oom.h.

enum oom_scan_t

Definition at line 25 of file oom.h.

Function Documentation

void check_panic_on_oom ( enum oom_constraint  constraint,
gfp_t  gfp_mask,
int  order,
const nodemask_t nodemask 

Definition at line 559 of file oom_kill.c.

void clear_zonelist_oom ( struct zonelist zonelist,
gfp_t  gfp_flags 

Definition at line 630 of file oom_kill.c.

void compare_swap_oom_score_adj ( int  old_val,
int  new_val 

Definition at line 56 of file oom_kill.c.

struct task_struct* find_lock_task_mm ( struct task_struct p)

Definition at line 140 of file oom_kill.c.

void mem_cgroup_out_of_memory ( struct mem_cgroup memcg,
gfp_t  gfp_mask,
int  order 

Definition at line 1501 of file memcontrol.c.

unsigned long oom_badness ( struct task_struct p,
struct mem_cgroup memcg,
const nodemask_t nodemask,
unsigned long  totalpages 

oom_badness - heuristic function to determine which candidate task to kill : task struct of which task we should calculate : total present RAM allowed for page allocation

The heuristic for determining which task to kill is made to be as simple and predictable as possible. The goal is to return the highest value for the task consuming the most memory to avoid subsequent oom failures.

Definition at line 183 of file oom_kill.c.

void oom_kill_process ( struct task_struct p,
gfp_t  gfp_mask,
int  order,
unsigned int  points,
unsigned long  totalpages,
struct mem_cgroup memcg,
nodemask_t nodemask,
const char message 

Definition at line 448 of file oom_kill.c.

enum oom_scan_t oom_scan_process_thread ( struct task_struct task,
unsigned long  totalpages,
const nodemask_t nodemask,
bool  force_kill 

Definition at line 291 of file oom_kill.c.

void out_of_memory ( struct zonelist zonelist,
gfp_t  gfp_mask,
int  order,
nodemask_t nodemask,
bool  force_kill 

out_of_memory - kill the "best" process when we run out of memory : zonelist pointer : memory allocation flags : amount of memory being requested as a power of 2 : nodemask passed to page allocator : true if a task must be killed, even if others are exiting

If we run out of memory, we have the choice between either killing a random task (bad), letting the system crash (worse) OR try to be smart about which process to kill. Note that we don't have to be perfect here, we just have to be good.

Definition at line 692 of file oom_kill.c.

int register_oom_notifier ( struct notifier_block nb)

Definition at line 580 of file oom_kill.c.

int test_set_oom_score_adj ( int  new_val)

test_set_oom_score_adj() - set current's oom_score_adj and return old value : new oom_score_adj value

Sets the oom_score_adj value for current to with proper synchronization and returns the old value. Usually used to temporarily set a value, save the old value in the caller, and then reinstate it later.

Definition at line 75 of file oom_kill.c.

int try_set_zonelist_oom ( struct zonelist zonelist,
gfp_t  gfp_flags 

Definition at line 597 of file oom_kill.c.

int unregister_oom_notifier ( struct notifier_block nb)

Definition at line 586 of file oom_kill.c.

Variable Documentation

bool oom_killer_disabled
int sysctl_oom_dump_tasks

Definition at line 44 of file oom_kill.c.

int sysctl_oom_kill_allocating_task

Definition at line 43 of file oom_kill.c.

int sysctl_panic_on_oom

Definition at line 42 of file oom_kill.c.