aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/android/lowmemorykiller.c16
-rw-r--r--fs/proc/base.c10
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/sched.h6
-rw-r--r--include/trace/events/oom.h4
-rw-r--r--include/trace/events/task.h8
-rw-r--r--mm/ksm.c2
-rw-r--r--mm/oom_kill.c10
-rw-r--r--mm/swapfile.c2
9 files changed, 31 insertions, 31 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);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9e28356a959a..aa63d25157b8 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -985,7 +985,7 @@ static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
985{ 985{
986 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); 986 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
987 char buffer[PROC_NUMBUF]; 987 char buffer[PROC_NUMBUF];
988 int oom_score_adj = OOM_SCORE_ADJ_MIN; 988 short oom_score_adj = OOM_SCORE_ADJ_MIN;
989 unsigned long flags; 989 unsigned long flags;
990 size_t len; 990 size_t len;
991 991
@@ -996,7 +996,7 @@ static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
996 unlock_task_sighand(task, &flags); 996 unlock_task_sighand(task, &flags);
997 } 997 }
998 put_task_struct(task); 998 put_task_struct(task);
999 len = snprintf(buffer, sizeof(buffer), "%d\n", oom_score_adj); 999 len = snprintf(buffer, sizeof(buffer), "%hd\n", oom_score_adj);
1000 return simple_read_from_buffer(buf, count, ppos, buffer, len); 1000 return simple_read_from_buffer(buf, count, ppos, buffer, len);
1001} 1001}
1002 1002
@@ -1043,15 +1043,15 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
1043 goto err_task_lock; 1043 goto err_task_lock;
1044 } 1044 }
1045 1045
1046 if (oom_score_adj < task->signal->oom_score_adj_min && 1046 if ((short)oom_score_adj < task->signal->oom_score_adj_min &&
1047 !capable(CAP_SYS_RESOURCE)) { 1047 !capable(CAP_SYS_RESOURCE)) {
1048 err = -EACCES; 1048 err = -EACCES;
1049 goto err_sighand; 1049 goto err_sighand;
1050 } 1050 }
1051 1051
1052 task->signal->oom_score_adj = oom_score_adj; 1052 task->signal->oom_score_adj = (short)oom_score_adj;
1053 if (has_capability_noaudit(current, CAP_SYS_RESOURCE)) 1053 if (has_capability_noaudit(current, CAP_SYS_RESOURCE))
1054 task->signal->oom_score_adj_min = oom_score_adj; 1054 task->signal->oom_score_adj_min = (short)oom_score_adj;
1055 trace_oom_score_adj_update(task); 1055 trace_oom_score_adj_update(task);
1056 1056
1057err_sighand: 1057err_sighand:
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4a4188da4570..922dab164eb0 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -29,8 +29,8 @@ enum oom_scan_t {
29 OOM_SCAN_SELECT, /* always select this thread first */ 29 OOM_SCAN_SELECT, /* always select this thread first */
30}; 30};
31 31
32extern void compare_swap_oom_score_adj(int old_val, int new_val); 32extern void compare_swap_oom_score_adj(short old_val, short new_val);
33extern int test_set_oom_score_adj(int new_val); 33extern short test_set_oom_score_adj(short new_val);
34 34
35extern unsigned long oom_badness(struct task_struct *p, 35extern unsigned long oom_badness(struct task_struct *p,
36 struct mem_cgroup *memcg, const nodemask_t *nodemask, 36 struct mem_cgroup *memcg, const nodemask_t *nodemask,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0dd42a02df2e..ed30456152da 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -631,9 +631,9 @@ struct signal_struct {
631 struct rw_semaphore group_rwsem; 631 struct rw_semaphore group_rwsem;
632#endif 632#endif
633 633
634 int oom_score_adj; /* OOM kill score adjustment */ 634 short oom_score_adj; /* OOM kill score adjustment */
635 int oom_score_adj_min; /* OOM kill score adjustment minimum value. 635 short oom_score_adj_min; /* OOM kill score adjustment min value.
636 * Only settable by CAP_SYS_RESOURCE. */ 636 * Only settable by CAP_SYS_RESOURCE. */
637 637
638 struct mutex cred_guard_mutex; /* guard against foreign influences on 638 struct mutex cred_guard_mutex; /* guard against foreign influences on
639 * credential calculations 639 * credential calculations
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index dd4ba3b92002..1e974983757e 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -14,7 +14,7 @@ TRACE_EVENT(oom_score_adj_update,
14 TP_STRUCT__entry( 14 TP_STRUCT__entry(
15 __field( pid_t, pid) 15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN ) 16 __array( char, comm, TASK_COMM_LEN )
17 __field( int, oom_score_adj) 17 __field( short, oom_score_adj)
18 ), 18 ),
19 19
20 TP_fast_assign( 20 TP_fast_assign(
@@ -23,7 +23,7 @@ TRACE_EVENT(oom_score_adj_update,
23 __entry->oom_score_adj = task->signal->oom_score_adj; 23 __entry->oom_score_adj = task->signal->oom_score_adj;
24 ), 24 ),
25 25
26 TP_printk("pid=%d comm=%s oom_score_adj=%d", 26 TP_printk("pid=%d comm=%s oom_score_adj=%hd",
27 __entry->pid, __entry->comm, __entry->oom_score_adj) 27 __entry->pid, __entry->comm, __entry->oom_score_adj)
28); 28);
29 29
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index b53add02e929..102a646e1996 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -15,7 +15,7 @@ TRACE_EVENT(task_newtask,
15 __field( pid_t, pid) 15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN) 16 __array( char, comm, TASK_COMM_LEN)
17 __field( unsigned long, clone_flags) 17 __field( unsigned long, clone_flags)
18 __field( int, oom_score_adj) 18 __field( short, oom_score_adj)
19 ), 19 ),
20 20
21 TP_fast_assign( 21 TP_fast_assign(
@@ -25,7 +25,7 @@ TRACE_EVENT(task_newtask,
25 __entry->oom_score_adj = task->signal->oom_score_adj; 25 __entry->oom_score_adj = task->signal->oom_score_adj;
26 ), 26 ),
27 27
28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%d", 28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd",
29 __entry->pid, __entry->comm, 29 __entry->pid, __entry->comm,
30 __entry->clone_flags, __entry->oom_score_adj) 30 __entry->clone_flags, __entry->oom_score_adj)
31); 31);
@@ -40,7 +40,7 @@ TRACE_EVENT(task_rename,
40 __field( pid_t, pid) 40 __field( pid_t, pid)
41 __array( char, oldcomm, TASK_COMM_LEN) 41 __array( char, oldcomm, TASK_COMM_LEN)
42 __array( char, newcomm, TASK_COMM_LEN) 42 __array( char, newcomm, TASK_COMM_LEN)
43 __field( int, oom_score_adj) 43 __field( short, oom_score_adj)
44 ), 44 ),
45 45
46 TP_fast_assign( 46 TP_fast_assign(
@@ -50,7 +50,7 @@ TRACE_EVENT(task_rename,
50 __entry->oom_score_adj = task->signal->oom_score_adj; 50 __entry->oom_score_adj = task->signal->oom_score_adj;
51 ), 51 ),
52 52
53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d", 53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%hd",
54 __entry->pid, __entry->oldcomm, 54 __entry->pid, __entry->oldcomm,
55 __entry->newcomm, __entry->oom_score_adj) 55 __entry->newcomm, __entry->oom_score_adj)
56); 56);
diff --git a/mm/ksm.c b/mm/ksm.c
index 31ae5ea1eac0..b4d5a9deb17f 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1919,7 +1919,7 @@ static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr,
1919 if (ksm_run != flags) { 1919 if (ksm_run != flags) {
1920 ksm_run = flags; 1920 ksm_run = flags;
1921 if (flags & KSM_RUN_UNMERGE) { 1921 if (flags & KSM_RUN_UNMERGE) {
1922 int oom_score_adj; 1922 short oom_score_adj;
1923 1923
1924 oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX); 1924 oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX);
1925 err = unmerge_and_remove_all_rmap_items(); 1925 err = unmerge_and_remove_all_rmap_items();
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 7e9e9113bd05..37ab4c5ab6e8 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -53,7 +53,7 @@ static DEFINE_SPINLOCK(zone_scan_lock);
53 * @old_val. Usually used to reinstate a previous value to prevent racing with 53 * @old_val. Usually used to reinstate a previous value to prevent racing with
54 * userspacing tuning the value in the interim. 54 * userspacing tuning the value in the interim.
55 */ 55 */
56void compare_swap_oom_score_adj(int old_val, int new_val) 56void compare_swap_oom_score_adj(short old_val, short new_val)
57{ 57{
58 struct sighand_struct *sighand = current->sighand; 58 struct sighand_struct *sighand = current->sighand;
59 59
@@ -72,7 +72,7 @@ void compare_swap_oom_score_adj(int old_val, int new_val)
72 * synchronization and returns the old value. Usually used to temporarily 72 * synchronization and returns the old value. Usually used to temporarily
73 * set a value, save the old value in the caller, and then reinstate it later. 73 * set a value, save the old value in the caller, and then reinstate it later.
74 */ 74 */
75int test_set_oom_score_adj(int new_val) 75short test_set_oom_score_adj(short new_val)
76{ 76{
77 struct sighand_struct *sighand = current->sighand; 77 struct sighand_struct *sighand = current->sighand;
78 int old_val; 78 int old_val;
@@ -193,7 +193,7 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
193 if (!p) 193 if (!p)
194 return 0; 194 return 0;
195 195
196 adj = p->signal->oom_score_adj; 196 adj = (long)p->signal->oom_score_adj;
197 if (adj == OOM_SCORE_ADJ_MIN) { 197 if (adj == OOM_SCORE_ADJ_MIN) {
198 task_unlock(p); 198 task_unlock(p);
199 return 0; 199 return 0;
@@ -399,7 +399,7 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas
399 continue; 399 continue;
400 } 400 }
401 401
402 pr_info("[%5d] %5d %5d %8lu %8lu %7lu %8lu %5d %s\n", 402 pr_info("[%5d] %5d %5d %8lu %8lu %7lu %8lu %5hd %s\n",
403 task->pid, from_kuid(&init_user_ns, task_uid(task)), 403 task->pid, from_kuid(&init_user_ns, task_uid(task)),
404 task->tgid, task->mm->total_vm, get_mm_rss(task->mm), 404 task->tgid, task->mm->total_vm, get_mm_rss(task->mm),
405 task->mm->nr_ptes, 405 task->mm->nr_ptes,
@@ -415,7 +415,7 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order,
415{ 415{
416 task_lock(current); 416 task_lock(current);
417 pr_warning("%s invoked oom-killer: gfp_mask=0x%x, order=%d, " 417 pr_warning("%s invoked oom-killer: gfp_mask=0x%x, order=%d, "
418 "oom_score_adj=%d\n", 418 "oom_score_adj=%hd\n",
419 current->comm, gfp_mask, order, 419 current->comm, gfp_mask, order,
420 current->signal->oom_score_adj); 420 current->signal->oom_score_adj);
421 cpuset_print_task_mems_allowed(current); 421 cpuset_print_task_mems_allowed(current);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 0fbb45283c66..bb6f6a04e92d 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1498,7 +1498,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
1498 struct address_space *mapping; 1498 struct address_space *mapping;
1499 struct inode *inode; 1499 struct inode *inode;
1500 struct filename *pathname; 1500 struct filename *pathname;
1501 int oom_score_adj; 1501 short oom_score_adj;
1502 int i, type, prev; 1502 int i, type, prev;
1503 int err; 1503 int err;
1504 1504