diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2012-04-01 19:24:46 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-04-08 14:32:31 -0400 |
commit | ae95a4582d707de8a57a8159ea81b16ba7bddd54 (patch) | |
tree | 2d4af6e521e655e52cb51476ccf7c20d1d8cfe9c /litmus/color_proc.c | |
parent | db4d9fcd3dfbda54b351ef42c13d93a00009784f (diff) |
Page reclaiming, control devices, cleanup.
Track allocated pages and add a proc handler to reclaim free pages and
add control device for allocating colored memory with mmap.
Diffstat (limited to 'litmus/color_proc.c')
-rw-r--r-- | litmus/color_proc.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/litmus/color_proc.c b/litmus/color_proc.c index 31eec0d728a5..cac336ac1731 100644 --- a/litmus/color_proc.c +++ b/litmus/color_proc.c | |||
@@ -5,14 +5,23 @@ | |||
5 | #include <litmus/color.h> | 5 | #include <litmus/color.h> |
6 | 6 | ||
7 | extern int color_sysctl_add_pages_data; /* litmus/color.c */ | 7 | extern int color_sysctl_add_pages_data; /* litmus/color.c */ |
8 | extern int color_sysctl_reclaim_pages_data; /* litmus/color.c */ | ||
8 | 9 | ||
9 | static int zero = 0; | 10 | static int zero = 0; |
10 | static int one = 1; | 11 | static int one = 1; |
11 | 12 | ||
12 | #define NR_PAGES_INDEX 1 /* location of nr_pages in the table below */ | 13 | #define NR_PAGES_INDEX 0 /* location of nr_pages in the table below */ |
13 | static struct ctl_table color_table[] = | 14 | static struct ctl_table color_table[] = |
14 | { | 15 | { |
15 | { | 16 | { |
17 | /* you MUST update NR_PAGES_INDEX if you move this entry */ | ||
18 | .procname = "nr_pages", | ||
19 | .mode = 0444, | ||
20 | .proc_handler = color_nr_pages_handler, | ||
21 | .data = NULL, /* dynamically set later */ | ||
22 | .maxlen = 0, /* also set later */ | ||
23 | }, | ||
24 | { | ||
16 | .procname = "add_pages", | 25 | .procname = "add_pages", |
17 | .data = &color_sysctl_add_pages_data, | 26 | .data = &color_sysctl_add_pages_data, |
18 | .maxlen = sizeof(int), | 27 | .maxlen = sizeof(int), |
@@ -22,11 +31,13 @@ static struct ctl_table color_table[] = | |||
22 | .extra2 = &one, | 31 | .extra2 = &one, |
23 | }, | 32 | }, |
24 | { | 33 | { |
25 | .procname = "nr_pages", | 34 | .procname = "reclaim_pages", |
26 | .mode = 0444, | 35 | .data = &color_sysctl_reclaim_pages_data, |
27 | .proc_handler = color_nr_pages_handler, | 36 | .maxlen = sizeof(int), |
28 | .data = NULL, /* dynamically later */ | 37 | .mode = 0644, |
29 | .maxlen = 0, /* also set later */ | 38 | .proc_handler = color_reclaim_pages_handler, |
39 | .extra1 = &zero, | ||
40 | .extra2 = &one, | ||
30 | }, | 41 | }, |
31 | { } | 42 | { } |
32 | }; | 43 | }; |
@@ -71,6 +82,7 @@ static struct ctl_table_header *litmus_sysctls; | |||
71 | static int __init litmus_sysctl_init(void) | 82 | static int __init litmus_sysctl_init(void) |
72 | { | 83 | { |
73 | int ret = 0; | 84 | int ret = 0; |
85 | printk(KERN_INFO "Registering LITMUS^RT proc sysctl.\n"); | ||
74 | litmus_sysctls = register_sysctl_table(litmus_dir_table); | 86 | litmus_sysctls = register_sysctl_table(litmus_dir_table); |
75 | if (!litmus_sysctls) { | 87 | if (!litmus_sysctls) { |
76 | printk(KERN_WARNING "Could not register LITMUS^RT sysctl.\n"); | 88 | printk(KERN_WARNING "Could not register LITMUS^RT sysctl.\n"); |