oom: give the dying task a higher priority
Luis Claudio R. Goncalves authored

In a system under heavy load it was observed that even after the
oom-killer selects a task to die, the task may take a long time to die.

Right after sending a SIGKILL to the task selected by the oom-killer this
task has its priority increased so that it can exit() soon, freeing
memory.  That is accomplished by:

        /*
         * We give our sacrificial lamb high priority and access to
         * all the memory it needs. That way it should be able to
         * exit() and clear out its resources quickly...
         */
 	p->rt.time_slice = HZ;
 	set_tsk_thread_flag(p, TIF_MEMDIE);

It sounds plausible giving the dying task an even higher priority to be
sure it will be scheduled sooner and free the desired memory.  It was
suggested on LKML using SCHED_FIFO:1, the lowest RT priority so that this
task won't interfere with any running RT task.

If the dying task is already an RT task, leave it untouched.  Another good
suggestion, implemented here, was to avoid boosting the dying task
priority in case of mem_cgroup OOM.
Signed-off-by: default avatarLuis Claudio R. Goncalves <lclaudio@uudg.org>
Signed-off-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: default avatarMinchan Kim <minchan.kim@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
93b43fa5
Name Last commit Last update
..
Kconfig lmb: rename to memblock
Kconfig.debug trivial: improve help text for mm debug config options
Makefile lmb: rename to memblock
backing-dev.c Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
bootmem.c x86,nobootmem: make alloc_bootmem_node fall back to other node when 32bit numa is used
bounce.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
compaction.c mm: compaction: add a tunable that decides when memory should be compacted and when it should be reclaimed
debug-pagealloc.c generic debug pagealloc
dmapool.c dmapools: protect page_list walk in show_pools()
fadvise.c readahead: introduce FMODE_RANDOM for POSIX_FADV_RANDOM
failslab.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
filemap.c gcc-4.6: mm: fix unused but set warnings
filemap_xip.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
fremap.c mm: clean up mm_counter
highmem.c mm,kdb,kgdb: Add a debug reference for the kdb kmap usage
hugetlb.c hugetlb: call mmu notifiers on hugepage cow
hwpoison-inject.c HWPOISON: Don't do early filtering if filter is disabled
init-mm.c mm: provide init_mm mm_context initializer
internal.h HWPOISON: add an interface to switch off/on all the page filters
kmemcheck.c kmemcheck: add hooks for the page allocator
kmemleak-test.c percpu: clean up percpu variable definitions
kmemleak.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
ksm.c mm: extend KSM refcounts to the anon_vma root
maccess.c maccess,probe_kernel: Allow arch specific override probe_kernel_(read|write)
madvise.c HWPOISON: Add a madvise() injector for soft page offlining
memblock.c
memcontrol.c
memory-failure.c
memory.c
memory_hotplug.c
mempolicy.c
mempool.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c
mmu_context.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c
oom_kill.c
page-writeback.c
page_alloc.c
page_cgroup.c
page_io.c
page_isolation.c
pagewalk.c
percpu-km.c
percpu-vm.c
percpu.c
percpu_up.c
prio_tree.c
quicklist.c
readahead.c
rmap.c
shmem.c
slab.c
slob.c
slub.c
sparse-vmemmap.c
sparse.c
swap.c
swap_state.c
swapfile.c
thrash.c
truncate.c
util.c
vmalloc.c
vmscan.c
vmstat.c