David Rientjes
e1e12d2f31
mm, oom: fix race when specifying a thread as the oom origin
...
test_set_oom_score_adj() and compare_swap_oom_score_adj() are used to
specify that current should be killed first if an oom condition occurs in
between the two calls.
The usage is
short oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX);
...
compare_swap_oom_score_adj(OOM_SCORE_ADJ_MAX, oom_score_adj);
to store the thread's oom_score_adj, temporarily change it to the maximum
score possible, and then restore the old value if it is still the same.
This happens to still be racy, however, if the user writes
OOM_SCORE_ADJ_MAX to /proc/pid/oom_score_adj in between the two calls.
The compare_swap_oom_score_adj() will then incorrectly reset the old value
prior to the write of OOM_SCORE_ADJ_MAX.
To fix this, introduce a new oom_flags_t member in struct signal_struct
that will be used for per-thread oom killer flags. KSM and swapoff can
now use a bit in this member to specify that threads should be killed
first in oom conditions without playing around with oom_score_adj.
This also allows the correct oom_score_adj to always be shown when reading
/proc/pid/oom_score.
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 >
2012-12-11 17:22:27 -08:00
..
2012-10-02 17:26:42 -07:00
2012-10-09 15:04:25 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-08 06:38:18 +09:00
2012-10-02 18:01:25 +01:00
2012-10-17 10:00:29 -03:00
2012-10-09 09:48:44 +01:00
2012-10-11 10:27:51 +09:00
2012-10-19 16:12:38 +01:00
2012-10-02 17:16:10 -07:00
2012-10-17 12:31:15 +01:00
2012-10-29 11:05:12 -07:00
2012-09-30 20:33:43 -07:00
2012-12-11 11:19:09 -08:00
2012-10-09 15:04:25 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-11-21 08:55:26 +01:00
2012-12-11 11:25:08 -08:00
2012-10-07 17:29:24 +09:00
2012-10-09 09:49:02 +01:00
2012-09-28 14:45:07 +01:00
2012-11-21 13:09:56 -08:00
2012-10-17 12:31:15 +01:00
2012-10-17 12:31:15 +01:00
2012-10-13 14:15:08 -07:00
2012-10-17 12:31:15 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-08 13:50:19 +10:30
2012-10-08 13:50:20 +10:30
2012-10-08 13:50:19 +10:30
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:46 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:26 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-26 17:41:24 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-02 10:52:28 -07:00
2012-12-11 11:25:08 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:51 +09:00
2012-10-10 12:02:25 +09:00
2012-10-12 10:27:27 +09:00
2012-10-13 10:46:48 +01:00
2012-10-12 06:37:36 -05:00
2012-10-19 14:07:47 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-02 18:32:35 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 09:28:09 +01:00
2012-10-02 18:01:25 +01:00
2012-09-27 15:35:23 +05:30
2012-10-24 15:57:14 -07:00
2012-11-28 11:54:40 +01:00
2012-10-13 10:46:48 +01:00
2012-09-29 12:21:03 -07:00
2012-09-29 12:21:03 -07:00
2012-10-16 18:49:15 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-22 11:28:10 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-09-26 21:10:00 -04:00
2012-09-26 22:20:08 -04:00
2012-10-13 10:46:48 +01:00
2012-09-28 11:47:42 +02:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:26 -08:00
2012-10-13 10:46:48 +01:00
2012-10-12 00:32:03 -04:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-06 03:04:57 +09:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:22 -08:00
2012-11-21 10:07:48 +01:00
2012-11-02 12:44:51 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:24 -08:00
2012-12-11 17:22:25 -08:00
2012-11-19 22:21:03 +00:00
2012-10-06 13:14:36 +02:00
2012-10-13 10:46:48 +01:00
2012-10-05 22:23:54 +02:00
2012-10-05 22:23:51 +02:00
2012-11-14 11:54:41 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-06 03:04:56 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-06 03:04:37 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:40 +09:00
2012-10-09 16:22:39 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-01 09:06:36 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-12 22:17:48 +09:00
2012-10-13 10:46:48 +01:00
2012-10-17 12:31:15 +01:00
2012-10-13 10:46:48 +01:00
2012-09-26 13:42:26 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:22 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-08 13:49:48 +10:30
2012-10-13 10:46:48 +01:00
2012-09-26 13:52:36 -07:00
2012-10-31 20:36:30 -02:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-10 20:14:07 +09:00
2012-10-10 01:15:44 -04:00
2012-10-02 19:01:32 -07:00
2012-10-06 02:48:09 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-24 11:52:21 -07:00
2012-10-11 08:50:16 +09:00
2012-10-09 16:23:02 +09:00
2012-12-11 17:22:23 -08:00
2012-12-06 11:56:43 -08:00
2012-12-11 17:22:27 -08:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:25 -08:00
2012-12-11 17:22:25 -08:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:58 +09:00
2012-11-16 14:33:04 -08:00
2012-10-01 18:02:07 -07:00
2012-10-10 20:00:55 +10:30
2012-09-28 14:31:03 +09:30
2012-10-08 13:50:21 +10:30
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-07 14:39:29 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-01 15:33:33 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-02 14:56:19 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:27 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-23 22:01:15 +00:00
2012-10-17 15:53:02 -05:00
2012-10-10 22:41:05 -04:00
2012-11-30 10:04:06 +00:00
2012-10-08 13:50:18 +10:30
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:27 -08:00
2012-12-11 17:22:22 -08:00
2012-10-11 08:50:14 +09:00
2012-12-11 17:22:26 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-05 22:23:53 +02:00
2012-10-13 10:46:48 +01:00
2012-11-28 07:33:50 -08:00
2012-10-06 03:04:44 +09:00
2012-10-24 10:01:59 +02:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-19 14:07:47 -07:00
2012-10-13 10:46:48 +01:00
2012-10-02 18:32:35 -07:00
2012-10-13 10:46:48 +01:00
2012-10-03 13:52:52 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-03 15:27:07 -04:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-05 09:26:01 -07:00
2012-10-25 14:37:52 -07:00
2012-10-09 16:22:40 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-06 03:05:21 +09:00
2012-11-16 14:33:04 -08:00
2012-10-09 16:22:43 +09:00
2012-10-06 03:05:01 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-09-27 12:45:28 +02:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:27 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-11 20:02:04 -04:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:25 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-07 00:40:54 -04:00
2012-09-29 10:02:27 +03:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:55 +09:00
2012-10-13 10:46:48 +01:00
2012-10-12 13:35:07 -04:00
2012-10-13 10:46:48 +01:00
2012-10-22 15:16:06 -04:00
2012-10-13 10:46:48 +01:00
2012-10-09 16:22:32 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:27 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-07 21:19:42 +02:00
2012-10-17 11:16:13 -07:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-09 11:24:47 +01:00
2012-09-28 15:05:15 +09:30
2012-10-09 16:22:59 +09:00
2012-10-09 16:22:59 +09:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 17:22:21 -08:00
2012-10-13 10:46:48 +01:00