alistair23-linux/fs/proc
Stephen Wilson 5b52fc890b proc: allocate storage for numa_maps statistics once
In show_numa_map() we collect statistics into a numa_maps structure.
Since the number of NUMA nodes can be very large, this structure is not a
candidate for stack allocation.

Instead of going thru a kmalloc()+kfree() cycle each time show_numa_map()
is invoked, perform the allocation just once when /proc/pid/numa_maps is
opened.

Performing the allocation when numa_maps is opened, and thus before a
reference to the target tasks mm is taken, eliminates a potential
stalemate condition in the oom-killer as originally described by Hugh
Dickins:

  ... imagine what happens if the system is out of memory, and the mm
  we're looking at is selected for killing by the OOM killer: while
  we wait in __get_free_page for more memory, no memory is freed
  from the selected mm because it cannot reach exit_mmap while we hold
  that reference.

Signed-off-by: Stephen Wilson <wilsons@start.ca>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-05-25 08:39:35 -07:00
..
array.c proc: protect mm start_code/end_code in /proc/pid/stat 2011-03-23 19:46:37 -07:00
base.c proc: do proper range check on readdir offset 2011-04-18 10:36:54 -07:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
generic.c proc: make struct proc_dir_entry::namelen unsigned int 2011-03-23 19:46:37 -07:00
inode.c procfs: kill the global proc_mnt variable 2011-03-23 19:46:58 -07:00
internal.h proc: make struct proc_maps_private truly private 2011-05-25 08:39:35 -07:00
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile
meminfo.c
mmu.c
nommu.c
page.c
proc_devtree.c of/flattree: Drop an uninteresting message to pr_debug level 2011-03-02 13:45:18 -07:00
proc_net.c
proc_sysctl.c Merge branch 'next' into for-linus 2011-03-16 09:41:17 +11:00
proc_tty.c
root.c procfs: kill the global proc_mnt variable 2011-03-23 19:46:58 -07:00
softirqs.c
stat.c
task_mmu.c proc: allocate storage for numa_maps statistics once 2011-05-25 08:39:35 -07:00
task_nommu.c report errors in /proc/*/*map* sanely 2011-03-23 16:36:50 -04:00
uptime.c
version.c
vmcore.c