|
@@ -40,7 +40,7 @@
|
|
|
#include <linux/notifier.h>
|
|
|
|
|
|
static uint32_t lowmem_debug_level = 2;
|
|
|
-static int lowmem_adj[6] = {
|
|
|
+static short lowmem_adj[6] = {
|
|
|
0,
|
|
|
1,
|
|
|
6,
|
|
@@ -70,9 +70,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
|
|
int rem = 0;
|
|
|
int tasksize;
|
|
|
int i;
|
|
|
- int min_score_adj = OOM_SCORE_ADJ_MAX + 1;
|
|
|
+ short min_score_adj = OOM_SCORE_ADJ_MAX + 1;
|
|
|
int selected_tasksize = 0;
|
|
|
- int selected_oom_score_adj;
|
|
|
+ short selected_oom_score_adj;
|
|
|
int array_size = ARRAY_SIZE(lowmem_adj);
|
|
|
int other_free = global_page_state(NR_FREE_PAGES);
|
|
|
int other_file = global_page_state(NR_FILE_PAGES) -
|
|
@@ -90,7 +90,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
|
|
}
|
|
|
}
|
|
|
if (sc->nr_to_scan > 0)
|
|
|
- lowmem_print(3, "lowmem_shrink %lu, %x, ofree %d %d, ma %d\n",
|
|
|
+ lowmem_print(3, "lowmem_shrink %lu, %x, ofree %d %d, ma %hd\n",
|
|
|
sc->nr_to_scan, sc->gfp_mask, other_free,
|
|
|
other_file, min_score_adj);
|
|
|
rem = global_page_state(NR_ACTIVE_ANON) +
|
|
@@ -107,7 +107,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
|
|
rcu_read_lock();
|
|
|
for_each_process(tsk) {
|
|
|
struct task_struct *p;
|
|
|
- int oom_score_adj;
|
|
|
+ short oom_score_adj;
|
|
|
|
|
|
if (tsk->flags & PF_KTHREAD)
|
|
|
continue;
|
|
@@ -141,11 +141,11 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
|
|
|
selected = p;
|
|
|
selected_tasksize = tasksize;
|
|
|
selected_oom_score_adj = oom_score_adj;
|
|
|
- lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n",
|
|
|
+ lowmem_print(2, "select %d (%s), adj %hd, size %d, to kill\n",
|
|
|
p->pid, p->comm, oom_score_adj, tasksize);
|
|
|
}
|
|
|
if (selected) {
|
|
|
- lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n",
|
|
|
+ lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n",
|
|
|
selected->pid, selected->comm,
|
|
|
selected_oom_score_adj, selected_tasksize);
|
|
|
lowmem_deathpending_timeout = jiffies + HZ;
|
|
@@ -176,7 +176,7 @@ static void __exit lowmem_exit(void)
|
|
|
}
|
|
|
|
|
|
module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
|
|
|
-module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size,
|
|
|
+module_param_array_named(adj, lowmem_adj, short, &lowmem_adj_size,
|
|
|
S_IRUGO | S_IWUSR);
|
|
|
module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size,
|
|
|
S_IRUGO | S_IWUSR);
|