2ff05b2b4e
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> |
||
---|---|---|
.. | ||
ABI | ||
accounting | ||
acpi | ||
aoe | ||
arm | ||
auxdisplay | ||
blackfin | ||
block | ||
blockdev | ||
cdrom | ||
cgroups | ||
connector | ||
console | ||
cpu-freq | ||
cpuidle | ||
cris | ||
crypto | ||
development-process | ||
device-mapper | ||
DocBook | ||
driver-model | ||
dvb | ||
early-userspace | ||
fault-injection | ||
fb | ||
filesystems | ||
firmware_class | ||
frv | ||
hwmon | ||
i2c | ||
i2o | ||
ia64 | ||
ide | ||
infiniband | ||
input | ||
ioctl | ||
isdn | ||
ja_JP | ||
kbuild | ||
kdump | ||
ko_KR | ||
laptops | ||
lguest | ||
m68k | ||
make | ||
mips | ||
misc-devices | ||
mn10300 | ||
mtd | ||
namespaces | ||
netlabel | ||
networking | ||
parisc | ||
PCI | ||
pcmcia | ||
power | ||
powerpc | ||
prctl | ||
RCU | ||
s390 | ||
scheduler | ||
scsi | ||
serial | ||
sh | ||
sound | ||
sparc | ||
spi | ||
sysctl | ||
telephony | ||
thermal | ||
timers | ||
trace | ||
uml | ||
usb | ||
video4linux | ||
vm | ||
w1 | ||
watchdog | ||
wimax | ||
x86 | ||
zh_CN | ||
00-INDEX | ||
applying-patches.txt | ||
atomic_ops.txt | ||
bad_memory.txt | ||
basic_profiling.txt | ||
binfmt_misc.txt | ||
braille-console.txt | ||
bt8xxgpio.txt | ||
BUG-HUNTING | ||
c2port.txt | ||
cachetlb.txt | ||
Changes | ||
CodingStyle | ||
cpu-hotplug.txt | ||
cpu-load.txt | ||
cputopology.txt | ||
credentials.txt | ||
dcdbas.txt | ||
debugging-modules.txt | ||
debugging-via-ohci1394.txt | ||
dell_rbu.txt | ||
devices.txt | ||
DMA-API.txt | ||
DMA-attributes.txt | ||
DMA-ISA-LPC.txt | ||
DMA-mapping.txt | ||
dmaengine.txt | ||
dontdiff | ||
dynamic-debug-howto.txt | ||
edac.txt | ||
eisa.txt | ||
email-clients.txt | ||
exception.txt | ||
feature-removal-schedule.txt | ||
futex-requeue-pi.txt | ||
gpio.txt | ||
highuid.txt | ||
HOWTO | ||
hw_random.txt | ||
ics932s401 | ||
initrd.txt | ||
Intel-IOMMU.txt | ||
io_ordering.txt | ||
io-mapping.txt | ||
IO-mapping.txt | ||
iostats.txt | ||
IPMI.txt | ||
IRQ-affinity.txt | ||
IRQ.txt | ||
irqflags-tracing.txt | ||
isapnp.txt | ||
java.txt | ||
kernel-doc-nano-HOWTO.txt | ||
kernel-docs.txt | ||
kernel-parameters.txt | ||
keys-request-key.txt | ||
keys.txt | ||
kmemleak.txt | ||
kobject.txt | ||
kprobes.txt | ||
kref.txt | ||
ldm.txt | ||
leds-class.txt | ||
local_ops.txt | ||
lockdep-design.txt | ||
lockstat.txt | ||
logo.gif | ||
logo.txt | ||
magic-number.txt | ||
Makefile | ||
ManagementStyle | ||
markers.txt | ||
mca.txt | ||
md.txt | ||
memory-barriers.txt | ||
memory-hotplug.txt | ||
memory.txt | ||
mono.txt | ||
mutex-design.txt | ||
nmi_watchdog.txt | ||
nommu-mmap.txt | ||
numastat.txt | ||
oops-tracing.txt | ||
parport-lowlevel.txt | ||
parport.txt | ||
pi-futex.txt | ||
pnp.txt | ||
preempt-locking.txt | ||
printk-formats.txt | ||
prio_tree.txt | ||
rbtree.txt | ||
rfkill.txt | ||
robust-futex-ABI.txt | ||
robust-futexes.txt | ||
rt-mutex-design.txt | ||
rt-mutex.txt | ||
rtc.txt | ||
SAK.txt | ||
SecurityBugs | ||
SELinux.txt | ||
serial-console.txt | ||
sgi-ioc4.txt | ||
sgi-visws.txt | ||
slow-work.txt | ||
SM501.txt | ||
Smack.txt | ||
sparse.txt | ||
spinlocks.txt | ||
stable_api_nonsense.txt | ||
stable_kernel_rules.txt | ||
SubmitChecklist | ||
SubmittingDrivers | ||
SubmittingPatches | ||
svga.txt | ||
sysfs-rules.txt | ||
sysrq.txt | ||
tomoyo.txt | ||
unaligned-memory-access.txt | ||
unicode.txt | ||
unshare.txt | ||
VGA-softcursor.txt | ||
video-output.txt | ||
volatile-considered-harmful.txt | ||
voyager.txt | ||
zorro.txt |