diff options
author | David Rientjes <rientjes@google.com> | 2012-12-11 19:02:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:27 -0500 |
commit | a9c58b907dbc6821533dfc295b63caf111ff1f16 (patch) | |
tree | e50714c48de89400a02a8e92ef4e240c5206bbcc /mm/oom_kill.c | |
parent | fa264375175a382621c5344a6508e02ec4d1c3c0 (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 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 7e9e9113bd0..37ab4c5ab6e 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 | */ |
56 | void compare_swap_oom_score_adj(int old_val, int new_val) | 56 | void 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 | */ |
75 | int test_set_oom_score_adj(int new_val) | 75 | short 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); |