linux/Documentation
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
..
ABI Merge branch 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block 2009-06-11 11:10:35 -07:00
accounting
acpi
aoe
arm [ARM] S3C24XX: GPIO: Change to macros for GPIO numbering 2009-05-18 16:26:03 +01:00
auxdisplay
blackfin Blackfin arch: Add document about bfin-gpio 2009-01-07 23:14:38 +08:00
block trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
blockdev mflash: initial support 2009-04-07 08:12:38 +02:00
cdrom
cgroups memcg: fix documentation 2009-04-13 15:04:33 -07:00
connector
console
cpu-freq
cpuidle
cris
crypto
development-process docs: Encourage better changelogs in the development process document 2009-06-04 10:32:49 -06:00
device-mapper
DocBook Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2009-06-15 03:02:23 -07:00
driver-model trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
dvb
early-userspace
fault-injection
fb trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
filesystems oom: move oom_adj value from task_struct to mm_struct 2009-06-16 19:47:43 -07:00
firmware_class
frv
hwmon hwmon: Update documentation on fan_max 2009-06-01 13:46:50 +02:00
i2c i2c-ocores: Can add I2C devices to the bus 2009-06-13 10:39:28 +01:00
i2o
ia64
ide ide: preserve Host Protected Area by default (v2) 2009-06-07 13:52:52 +02:00
infiniband IPoIB: Document newish features 2009-04-08 13:52:01 -07:00
input Input: multitouch - augment event semantics documentation 2009-05-23 09:53:26 -07:00
ioctl
isdn isdn: extend INTERFACE.CAPI document 2009-06-08 00:45:52 -07:00
ja_JP
kbuild kconfig: resort the documentation of the environment variables 2009-06-09 22:37:47 +02:00
kdump trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
ko_KR
laptops trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
lguest lguest: add support for indirect ring entries 2009-06-12 22:27:13 +09:30
m68k
make
mips
misc-devices
mn10300 trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
mtd trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
namespaces
netlabel
networking Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2009-06-15 03:02:23 -07:00
parisc
PCI
pcmcia
power Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-06-14 13:46:25 -07:00
powerpc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-06-15 09:40:05 -07:00
prctl
RCU trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
s390 trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
scheduler trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
scsi trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
serial
sh
sound Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-06-14 13:46:25 -07:00
sparc
spi spi: documentation: emphasise spi_master.setup() semantics 2009-04-21 13:41:50 -07:00
sysctl page allocator: use allocation flags as an index to the zone watermark 2009-06-16 19:47:35 -07:00
telephony
thermal
timers trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
trace trivial: Remove the hyphen from git commands 2009-06-12 18:01:51 +02:00
uml
usb trivial: usb: fix missing space typo in doc 2009-06-12 18:01:51 +02:00
video4linux trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
vm pagemap: add page-types tool 2009-06-16 19:47:38 -07:00
w1
watchdog
wimax
x86 Merge branch 'linus' into x86/mce3 2009-06-11 23:31:52 +02:00
zh_CN
00-INDEX
applying-patches.txt
atomic_ops.txt
bad_memory.txt
basic_profiling.txt
binfmt_misc.txt
braille-console.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
bt8xxgpio.txt
BUG-HUNTING
c2port.txt
cachetlb.txt
Changes Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next 2009-06-14 14:12:18 -07:00
CodingStyle trivial: fix typo milisecond/millisecond for documentation and source comments. 2009-06-12 18:01:46 +02:00
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
credentials.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt trivial: Documentation/dell_rbu.txt: fix typos 2009-06-12 18:01:50 +02:00
devices.txt lanana: assign a device name and numbering for MAX3100 2009-04-07 08:44:05 -07:00
DMA-API.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
DMA-attributes.txt
DMA-ISA-LPC.txt
DMA-mapping.txt dma-mapping: update the old macro DMA_nBIT_MASK related documentations 2009-04-07 08:31:12 -07:00
dmaengine.txt
dontdiff
dynamic-debug-howto.txt
edac.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
eisa.txt
email-clients.txt
exception.txt
feature-removal-schedule.txt Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2009-06-15 03:02:23 -07:00
futex-requeue-pi.txt futex: add requeue-pi documentation 2009-05-09 07:12:50 +02:00
gpio.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
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-doc: restrict syntax for private: and public: 2009-05-02 15:36:10 -07:00
kernel-docs.txt
kernel-parameters.txt Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2009-06-15 09:32:52 -07:00
keys-request-key.txt
keys.txt
kmemleak.txt kmemleak: Add documentation on the memory leak detector 2009-06-11 17:03:29 +01:00
kobject.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
kprobes.txt kprobes: support kretprobe and jprobe per-probe disabling 2009-04-07 08:31:08 -07:00
kref.txt
ldm.txt
leds-class.txt
local_ops.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
lockdep-design.txt locking: Documentation: lockdep-design.txt, fix note of state bits 2009-04-26 18:21:24 +02:00
lockstat.txt
logo.gif Revert "linux.conf.au 2009: Tuz" 2009-04-27 12:00:27 -07:00
logo.txt Revert "linux.conf.au 2009: Tuz" 2009-04-27 12:00:27 -07:00
magic-number.txt
Makefile
ManagementStyle
markers.txt
mca.txt
md.txt
memory-barriers.txt sched: Document memory barriers implied by sleep/wake-up primitives 2009-04-29 14:15:55 +02:00
memory-hotplug.txt trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
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 trivial: rbtree.txt: fix rb_entry() parameters in sample code 2009-06-12 18:01:47 +02:00
rfkill.txt rfkill: document /dev/rfkill 2009-06-03 14:06:15 -04:00
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 trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
Smack.txt smack: implement logging V3 2009-04-14 09:00:23 +10:00
sparse.txt Documentation: explain the difference between __bitwise and __bitwise__ 2009-04-11 08:18:11 +02:00
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
SubmitChecklist
SubmittingDrivers
SubmittingPatches Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-06-14 13:46:25 -07:00
svga.txt
sysfs-rules.txt Doc/sysfs-rules: Swap the order of the words so the sentence makes more sense 2009-05-08 19:22:20 -07:00
sysrq.txt
tomoyo.txt tomoyo: add Documentation/tomoyo.txt 2009-04-14 09:14:58 +10:00
unaligned-memory-access.txt
unicode.txt
unshare.txt
VGA-softcursor.txt
video-output.txt
volatile-considered-harmful.txt
voyager.txt
zorro.txt