Files
tegra-linux-noble/include/linux
David Rientjes 2ff05b2b4e oom: move oom_adj value from task_struct to mm_struct
The per-task oom_adj value is a characteristic of its mm more than the
task itself since it's not possible to oom kill any thread that shares the
mm.  If a task were to be killed while attached to an mm that could not be
freed because another thread were set to OOM_DISABLE, it would have
needlessly been terminated since there is no potential for future memory
freeing.

This patch moves oomkilladj (now more appropriately named oom_adj) from
struct task_struct to struct mm_struct.  This requires task_lock() on a
task to check its oom_adj value to protect against exec, but it's already
necessary to take the lock when dereferencing the mm to find the total VM
size for the badness heuristic.

This fixes a livelock if the oom killer chooses a task and another thread
sharing the same memory has an oom_adj value of OOM_DISABLE.  This occurs
because oom_kill_task() repeatedly returns 1 and refuses to kill the
chosen task while select_bad_process() will repeatedly choose the same
task during the next retry.

Taking task_lock() in select_bad_process() to check for OOM_DISABLE and in
oom_kill_task() to check for threads sharing the same memory will be
removed in the next patch in this series where it will no longer be
necessary.

Writing to /proc/pid/oom_adj for a kthread will now return -EINVAL since
these threads are immune from oom killing already.  They simply report an
oom_adj value of OOM_DISABLE.

Cc: Nick Piggin <npiggin@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-16 19:47:43 -07:00
..
2009-04-07 10:23:34 +01:00
2009-06-11 21:36:00 -04:00
2009-03-05 14:39:32 -05:00
2009-01-30 23:38:03 +05:30
2009-01-30 23:38:37 +05:30
2009-02-12 09:40:14 +11:00
2009-04-01 08:59:23 -07:00
2009-01-30 23:39:42 +05:30
2009-06-01 06:21:13 +00:00
2009-01-30 23:40:06 +05:30
2009-05-02 15:36:10 -07:00
2009-04-23 10:06:35 +01:00
2009-06-11 21:36:09 -04:00
2009-01-30 23:44:08 +05:30
2009-04-03 14:53:32 -07:00
2009-05-29 08:40:01 -07:00
2009-06-11 08:50:57 -07:00
2009-06-11 21:36:06 -04:00
2009-03-01 00:19:35 -08:00
2009-01-30 23:46:03 +05:30
2009-04-03 14:53:32 -07:00
2009-01-30 23:46:40 +05:30
2009-01-30 23:48:33 +05:30
2009-02-10 00:41:26 +01:00
2009-03-16 08:32:27 -06:00
2009-06-16 19:47:28 -07:00
2009-01-30 23:51:17 +05:30
2009-01-30 23:51:41 +05:30
2009-04-02 19:04:53 -07:00
2009-06-03 14:05:10 -04:00
2009-01-30 23:52:16 +05:30
2009-01-30 23:53:12 +05:30
2009-01-30 23:53:40 +05:30
2009-01-30 23:54:53 +05:30
2009-01-30 23:55:45 +05:30
2009-01-30 23:56:13 +05:30
2009-01-30 23:56:48 +05:30
2009-05-19 16:02:02 -07:00
2009-01-30 23:57:16 +05:30
2009-05-22 09:43:41 +10:00
2009-02-02 21:40:58 +05:30
2009-06-02 00:45:24 -07:00
2009-06-16 19:47:28 -07:00
2009-06-14 22:10:41 +02:00
2009-04-21 13:41:48 -07:00
2009-04-21 13:41:48 -07:00
2009-01-30 23:59:44 +05:30
2009-01-31 00:00:06 +05:30
2009-06-11 17:03:28 +01:00
2009-06-10 11:48:39 +03:00
2009-04-06 16:06:26 +01:00
2009-04-28 07:37:28 +02:00
2009-04-14 09:00:19 +10:00
2009-04-29 17:32:35 -07:00
2009-01-31 00:00:35 +05:30
2009-06-11 19:05:32 +02:00
2009-05-25 00:55:45 -07:00
2009-06-11 21:36:02 -04:00
2009-01-31 00:01:11 +05:30
2009-03-20 10:48:14 -07:00
2009-06-11 21:36:01 -04:00
2009-03-15 19:59:13 -07:00
2009-04-03 17:41:23 -07:00
2009-04-01 13:28:15 -04:00
2009-04-03 17:41:12 -07:00
2009-03-10 20:33:18 -04:00
2009-04-30 15:32:11 +00:00
2009-04-01 08:59:13 -07:00
2009-04-01 08:59:13 -07:00
2009-01-31 00:02:54 +05:30
2009-01-31 00:03:40 +05:30
2009-04-24 08:54:21 +02:00
2009-04-01 08:59:13 -07:00
2009-03-13 16:09:12 -07:00
2009-03-30 15:22:01 +02:00
2009-06-11 21:36:12 -04:00
2009-03-26 02:18:35 +01:00
2009-01-31 00:05:59 +05:30
2009-02-26 23:42:11 -08:00
2009-03-30 14:28:58 -07:00
2009-05-09 10:49:41 -04:00
2009-04-01 08:59:24 -07:00
2009-04-08 14:33:38 -07:00
2009-06-11 08:50:58 -07:00
2009-02-27 16:53:50 +09:00
2009-04-13 15:04:29 -07:00
2009-01-31 00:06:33 +05:30
2009-04-21 19:40:00 -07:00
2009-04-27 02:45:02 -07:00
2009-03-27 12:18:56 -04:00
2009-01-31 00:07:00 +05:30
2009-05-12 11:11:48 +02:00
2009-04-02 19:05:01 -07:00
2009-02-18 15:37:53 -08:00
2009-02-03 11:23:12 +11:00
2009-06-11 08:50:59 -07:00
2009-06-11 08:51:01 -07:00
2009-03-26 18:14:21 +01:00
2009-04-17 10:50:27 -07:00