Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
cmm.c File Reference
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/gfp.h>
#include <linux/init.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/oom.h>
#include <linux/reboot.h>
#include <linux/sched.h>
#include <linux/stringify.h>
#include <linux/swap.h>
#include <linux/device.h>
#include <asm/firmware.h>
#include <asm/hvcall.h>
#include <asm/mmu.h>
#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <linux/memory.h>
#include "plpar_wrappers.h"

Go to the source code of this file.

Data Structures

struct  cmm_page_array
 

Macros

#define CMM_DRIVER_VERSION   "1.0.0"
 
#define CMM_DEFAULT_DELAY   1
 
#define CMM_HOTPLUG_DELAY   5
 
#define CMM_DEBUG   0
 
#define CMM_DISABLE   0
 
#define CMM_OOM_KB   1024
 
#define CMM_MIN_MEM_MB   256
 
#define KB2PAGES(_p)   ((_p)>>(PAGE_SHIFT-10))
 
#define PAGES2KB(_p)   ((_p)<<(PAGE_SHIFT-10))
 
#define CMM_MEM_HOTPLUG_PRI   1
 
#define CMM_MEM_ISOLATE_PRI   15
 
#define CMM_NR_PAGES   ((PAGE_SIZE - sizeof(void *) - sizeof(unsigned long)) / sizeof(unsigned long))
 
#define cmm_dbg(...)   if (cmm_debug) { printk(KERN_INFO "cmm: "__VA_ARGS__); }
 
#define CMM_SHOW(name, format, args...)
 

Functions

 MODULE_AUTHOR ("Brian King <[email protected]>")
 
 MODULE_DESCRIPTION ("IBM System p Collaborative Memory Manager")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (CMM_DRIVER_VERSION)
 
 module_param_named (delay, delay, uint, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (delay,"Delay (in seconds) between polls to query hypervisor paging requests. ""[Default="__stringify(CMM_DEFAULT_DELAY)"]")
 
 module_param_named (hotplug_delay, hotplug_delay, uint, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (delay,"Delay (in seconds) after memory hotplug remove ""before loaning resumes. ""[Default="__stringify(CMM_HOTPLUG_DELAY)"]")
 
 module_param_named (oom_kb, oom_kb, uint, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (oom_kb,"Amount of memory in kb to free on OOM. ""[Default="__stringify(CMM_OOM_KB)"]")
 
 module_param_named (min_mem_mb, min_mem_mb, ulong, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (min_mem_mb,"Minimum amount of memory (in MB) to not balloon. ""[Default="__stringify(CMM_MIN_MEM_MB)"]")
 
 module_param_named (debug, cmm_debug, uint, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (debug,"Enable module debugging logging. Set to 1 to enable. ""[Default="__stringify(CMM_DEBUG)"]")
 
 CMM_SHOW (loaned_kb,"%lu\n", PAGES2KB(loaned_pages))
 
 CMM_SHOW (loaned_target_kb,"%lu\n", PAGES2KB(loaned_pages_target))
 
 module_param_call (disable, cmm_set_disable, param_get_uint,&cmm_disabled, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (disable,"Disable CMM. Set to 1 to disable. ""[Default="__stringify(CMM_DISABLE)"]")
 
 module_init (cmm_init)
 
 module_exit (cmm_exit)
 

Macro Definition Documentation

#define cmm_dbg (   ...)    if (cmm_debug) { printk(KERN_INFO "cmm: "__VA_ARGS__); }

Definition at line 94 of file cmm.c.

#define CMM_DEBUG   0

Definition at line 49 of file cmm.c.

#define CMM_DEFAULT_DELAY   1

Definition at line 47 of file cmm.c.

#define CMM_DISABLE   0

Definition at line 50 of file cmm.c.

#define CMM_DRIVER_VERSION   "1.0.0"

Definition at line 46 of file cmm.c.

#define CMM_HOTPLUG_DELAY   5

Definition at line 48 of file cmm.c.

#define CMM_MEM_HOTPLUG_PRI   1

Definition at line 59 of file cmm.c.

#define CMM_MEM_ISOLATE_PRI   15

Definition at line 60 of file cmm.c.

#define CMM_MIN_MEM_MB   256

Definition at line 52 of file cmm.c.

#define CMM_NR_PAGES   ((PAGE_SIZE - sizeof(void *) - sizeof(unsigned long)) / sizeof(unsigned long))

Definition at line 92 of file cmm.c.

#define CMM_OOM_KB   1024

Definition at line 51 of file cmm.c.

#define CMM_SHOW (   name,
  format,
  args... 
)
Value:
static ssize_t show_##name(struct device *dev, \
char *buf) \
{ \
return sprintf(buf, format, ##args); \
} \
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)

Definition at line 349 of file cmm.c.

#define KB2PAGES (   _p)    ((_p)>>(PAGE_SHIFT-10))

Definition at line 53 of file cmm.c.

#define PAGES2KB (   _p)    ((_p)<<(PAGE_SHIFT-10))

Definition at line 54 of file cmm.c.

Function Documentation

CMM_SHOW ( loaned_kb  ,
"%lu\n"  ,
PAGES2KB(loaned_pages)   
)
CMM_SHOW ( loaned_target_kb  ,
"%lu\n"  ,
PAGES2KB(loaned_pages_target)   
)
MODULE_AUTHOR ( "Brian King <[email protected]>"  )
MODULE_DESCRIPTION ( "IBM System p Collaborative Memory Manager"  )
module_exit ( cmm_exit  )
module_init ( cmm_init  )
MODULE_LICENSE ( "GPL"  )
module_param_call ( disable  ,
cmm_set_disable  ,
param_get_uint  ,
cmm_disabled,
S_IRUGO S_IWUSR 
)
module_param_named ( delay  ,
delay  ,
uint  ,
S_IRUGO S_IWUSR 
)
module_param_named ( hotplug_delay  ,
hotplug_delay  ,
uint  ,
S_IRUGO S_IWUSR 
)
module_param_named ( oom_kb  ,
oom_kb  ,
uint  ,
S_IRUGO S_IWUSR 
)
module_param_named ( min_mem_mb  ,
min_mem_mb  ,
ulong  ,
S_IRUGO S_IWUSR 
)
module_param_named ( debug  ,
cmm_debug  ,
uint  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( delay  ,
"Delay (in seconds) between polls to query hypervisor paging requests. """  [Default="__stringify(CMM_DEFAULT_DELAY)"] 
)
MODULE_PARM_DESC ( delay  ,
"Delay (in seconds) after memory hotplug remove ""before loaning resumes. """  [Default="__stringify(CMM_HOTPLUG_DELAY)"] 
)
MODULE_PARM_DESC ( oom_kb  ,
"Amount of memory in kb to free on OOM. """  [Default="__stringify(CMM_OOM_KB)"] 
)
MODULE_PARM_DESC ( min_mem_mb  ,
"Minimum amount of memory (in MB) to not balloon. """  [Default="__stringify(CMM_MIN_MEM_MB)"] 
)
MODULE_PARM_DESC ( debug  ,
"Enable module debugging logging. Set to 1 to enable. """  [Default="__stringify(CMM_DEBUG)"] 
)
MODULE_PARM_DESC ( disable  ,
"Disable CMM. Set to 1 to disable. """  [Default="__stringify(CMM_DISABLE)"] 
)
MODULE_VERSION ( CMM_DRIVER_VERSION  )