linux/drivers/staging/android
Tetsuo Handa 77ed2c5745 android,lowmemorykiller: Don't abuse TIF_MEMDIE.
Currently, lowmemorykiller (LMK) is using TIF_MEMDIE for two purposes.
One is to remember processes killed by LMK, and the other is to
accelerate termination of processes killed by LMK.

But since LMK is invoked as a memory shrinker function, there still
should be some memory available. It is very likely that memory
allocations by processes killed by LMK will succeed without using
ALLOC_NO_WATERMARKS via TIF_MEMDIE. Even if their allocations cannot
escape from memory allocation loop unless they use ALLOC_NO_WATERMARKS,
lowmem_deathpending_timeout can guarantee forward progress by choosing
next victim process.

On the other hand, mark_oom_victim() assumes that it must be called with
oom_lock held and it must not be called after oom_killer_disable() was
called. But LMK is calling it without holding oom_lock and checking
oom_killer_disabled. It is possible that LMK calls mark_oom_victim()
due to allocation requests by kernel threads after current thread
returned from oom_killer_disabled(). This will break synchronization
for PM/suspend.

This patch introduces per a task_struct flag for remembering processes
killed by LMK, and replaces TIF_MEMDIE with that flag. By applying this
patch, assumption by mark_oom_victim() becomes true.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Arve Hjonnevag <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-04 12:41:24 -07:00
..
ion Staging: android: change memory allocation style in ion.c 2016-03-30 18:33:27 -07:00
trace staging/android: remove SYNC_WAIT ioctl 2016-02-07 17:34:58 -08:00
uapi staging/android: remove len field from struct sync_fence_info 2016-02-07 17:34:58 -08:00
Kconfig android: remove timed output/gpio driver 2016-03-30 18:31:37 -07:00
Makefile android: remove timed output/gpio driver 2016-03-30 18:31:37 -07:00
TODO staging/android: add TODO to de-stage android sync framework 2015-12-14 11:05:45 -08:00
ashmem.c Merge branch 'mm-pkeys-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-03-20 19:08:56 -07:00
ashmem.h staging: android: Split uapi out of ashmem.h 2014-02-18 11:03:28 -08:00
lowmemorykiller.c android,lowmemorykiller: Don't abuse TIF_MEMDIE. 2016-04-04 12:41:24 -07:00
sw_sync.c staging/android: remove driver_data from struct sync_fence_info 2016-02-07 17:34:58 -08:00
sw_sync.h staging/android: remove struct sync_pt 2016-02-07 17:34:58 -08:00
sync.c staging: android: Remove unneeded else following a return 2016-02-20 15:24:51 -08:00
sync.h staging/android: remove driver_data from struct sync_fence_info 2016-02-07 17:34:58 -08:00
sync_debug.c drivers/staging/android: don't use modular references in sync_debug.c 2016-02-14 16:35:00 -08:00