aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-12-11 19:02:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 20:22:27 -0500
commita9c58b907dbc6821533dfc295b63caf111ff1f16 (patch)
treee50714c48de89400a02a8e92ef4e240c5206bbcc /drivers/staging
parentfa264375175a382621c5344a6508e02ec4d1c3c0 (diff)
mm, oom: change type of oom_score_adj to short
The maximum oom_score_adj is 1000 and the minimum oom_score_adj is -1000, so this range can be represented by the signed short type with no functional change. The extra space this frees up in struct signal_struct will be used for per-thread oom kill flags in the next patch. Signed-off-by: David Rientjes <rientjes@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Michal Hocko <mhocko@suse.cz> Cc: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/android/lowmemorykiller.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index b91e4bc332a7..3b91b0fd4de3 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -40,7 +40,7 @@
40#include <linux/notifier.h> 40#include <linux/notifier.h>
41 41
42static uint32_t lowmem_debug_level = 2; 42static uint32_t lowmem_debug_level = 2;
43static int lowmem_adj[6] = { 43static short lowmem_adj[6] = {
44 0, 44 0,
45 1, 45 1,
46 6, 46 6,
@@ -70,9 +70,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
70 int rem = 0; 70 int rem = 0;
71 int tasksize; 71 int tasksize;
72 int i; 72 int i;
73 int min_score_adj = OOM_SCORE_ADJ_MAX + 1; 73 short min_score_adj = OOM_SCORE_ADJ_MAX + 1;
74 int selected_tasksize = 0; 74 int selected_tasksize = 0;
75 int selected_oom_score_adj; 75 short selected_oom_score_adj;
76 int array_size = ARRAY_SIZE(lowmem_adj); 76 int array_size = ARRAY_SIZE(lowmem_adj);
77 int other_free = global_page_state(NR_FREE_PAGES); 77 int other_free = global_page_state(NR_FREE_PAGES);
78 int other_file = global_page_state(NR_FILE_PAGES) - 78 int other_file = global_page_state(NR_FILE_PAGES) -
@@ -90,7 +90,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
90 } 90 }
91 } 91 }
92 if (sc->nr_to_scan > 0) 92 if (sc->nr_to_scan > 0)
93 lowmem_print(3, "lowmem_shrink %lu, %x, ofree %d %d, ma %d\n", 93 lowmem_print(3, "lowmem_shrink %lu, %x, ofree %d %d, ma %hd\n",
94 sc->nr_to_scan, sc->gfp_mask, other_free, 94 sc->nr_to_scan, sc->gfp_mask, other_free,
95 other_file, min_score_adj); 95 other_file, min_score_adj);
96 rem = global_page_state(NR_ACTIVE_ANON) + 96 rem = global_page_state(NR_ACTIVE_ANON) +
@@ -107,7 +107,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
107 rcu_read_lock(); 107 rcu_read_lock();
108 for_each_process(tsk) { 108 for_each_process(tsk) {
109 struct task_struct *p; 109 struct task_struct *p;
110 int oom_score_adj; 110 short oom_score_adj;
111 111
112 if (tsk->flags & PF_KTHREAD) 112 if (tsk->flags & PF_KTHREAD)
113 continue; 113 continue;
@@ -141,11 +141,11 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
141 selected = p; 141 selected = p;
142 selected_tasksize = tasksize; 142 selected_tasksize = tasksize;
143 selected_oom_score_adj = oom_score_adj; 143 selected_oom_score_adj = oom_score_adj;
144 lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n", 144 lowmem_print(2, "select %d (%s), adj %hd, size %d, to kill\n",
145 p->pid, p->comm, oom_score_adj, tasksize); 145 p->pid, p->comm, oom_score_adj, tasksize);
146 } 146 }
147 if (selected) { 147 if (selected) {
148 lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", 148 lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n",
149 selected->pid, selected->comm, 149 selected->pid, selected->comm,
150 selected_oom_score_adj, selected_tasksize); 150 selected_oom_score_adj, selected_tasksize);
151 lowmem_deathpending_timeout = jiffies + HZ; 151 lowmem_deathpending_timeout = jiffies + HZ;
@@ -176,7 +176,7 @@ static void __exit lowmem_exit(void)
176} 176}
177 177
178module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); 178module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
179module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size, 179module_param_array_named(adj, lowmem_adj, short, &lowmem_adj_size,
180 S_IRUGO | S_IWUSR); 180 S_IRUGO | S_IWUSR);
181module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size, 181module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size,
182 S_IRUGO | S_IWUSR); 182 S_IRUGO | S_IWUSR);