OpenCloudOS-Kernel/arch/frv/kernel
David Howells 8feae13110 NOMMU: Make VMAs per MM as for MMU-mode linux
Make VMAs per mm_struct as for MMU-mode linux.  This solves two problems:

 (1) In SYSV SHM where nattch for a segment does not reflect the number of
     shmat's (and forks) done.

 (2) In mmap() where the VMA's vm_mm is set to point to the parent mm by an
     exec'ing process when VM_EXECUTABLE is specified, regardless of the fact
     that a VMA might be shared and already have its vm_mm assigned to another
     process or a dead process.

A new struct (vm_region) is introduced to track a mapped region and to remember
the circumstances under which it may be shared and the vm_list_struct structure
is discarded as it's no longer required.

This patch makes the following additional changes:

 (1) Regions are now allocated with alloc_pages() rather than kmalloc() and
     with no recourse to __GFP_COMP, so the pages are not composite.  Instead,
     each page has a reference on it held by the region.  Anything else that is
     interested in such a page will have to get a reference on it to retain it.
     When the pages are released due to unmapping, each page is passed to
     put_page() and will be freed when the page usage count reaches zero.

 (2) Excess pages are trimmed after an allocation as the allocation must be
     made as a power-of-2 quantity of pages.

 (3) VMAs are added to the parent MM's R/B tree and mmap lists.  As an MM may
     end up with overlapping VMAs within the tree, the VMA struct address is
     appended to the sort key.

 (4) Non-anonymous VMAs are now added to the backing inode's prio list.

 (5) Holes may be punched in anonymous VMAs with munmap(), releasing parts of
     the backing region.  The VMA and region structs will be split if
     necessary.

 (6) sys_shmdt() only releases one attachment to a SYSV IPC shared memory
     segment instead of all the attachments at that addresss.  Multiple
     shmat()'s return the same address under NOMMU-mode instead of different
     virtual addresses as under MMU-mode.

 (7) Core dumping for ELF-FDPIC requires fewer exceptions for NOMMU-mode.

 (8) /proc/maps is now the global list of mapped regions, and may list bits
     that aren't actually mapped anywhere.

 (9) /proc/meminfo gains a line (tagged "MmapCopy") that indicates the amount
     of RAM currently allocated by mmap to hold mappable regions that can't be
     mapped directly.  These are copies of the backing device or file if not
     anonymous.

These changes make NOMMU mode more similar to MMU mode.  The downside is that
NOMMU mode requires some extra memory to track things over NOMMU without this
patch (VMAs are no longer shared, and there are now region structs).

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Mike Frysinger <vapier.adi@gmail.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
2009-01-08 12:04:47 +00:00
..
Makefile Generic semaphore implementation 2008-04-17 10:42:34 -04:00
asm-offsets.c frv: use kbuild.h instead of defining macros in asm-offsets.c 2008-04-29 08:06:30 -07:00
break.S FRV: arrange things such that BRA can reach from the trap table 2007-11-29 09:24:54 -08:00
cmode.S Fix various old email addresses for dwmw2 2008-06-06 11:29:10 -07:00
debug-stub.c [PATCH] FRV: Introduce asm-offsets for FRV arch 2006-07-10 13:24:22 -07:00
dma.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
entry-table.S FRV: Add support for emulation of userspace atomic ops [try #2] 2008-04-10 13:41:29 -07:00
entry.S FRV: Wire up new system calls 2008-08-01 13:03:49 -07:00
frv_ksyms.c Generic semaphore implementation 2008-04-17 10:42:34 -04:00
futex.c [PATCH] arch/frv/kernel/futex.c must #include <linux/uaccess.h> 2006-12-07 08:39:26 -08:00
gdb-io.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gdb-io.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gdb-stub.c frv: use the common ascii hex helpers 2008-07-26 12:00:05 -07:00
head-mmu-fr451.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head-uc-fr401.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head-uc-fr451.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head-uc-fr555.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head.S [PATCH] FRV: Introduce asm-offsets for FRV arch 2006-07-10 13:24:22 -07:00
head.inc FRV: Make NOMMU-mode work with base addresses other than 0xC0000000 [try #2] 2008-04-10 13:41:29 -07:00
init_task.c take init_fs to saner place 2008-12-31 18:07:42 -05:00
irq-mb93091.c remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
irq-mb93093.c remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
irq-mb93493.c remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
irq.c spelling fixes: arch/frv/ 2007-10-20 01:09:42 +02:00
kernel_execve.S [PATCH] provide kernel_execve on all architectures 2006-10-02 07:57:23 -07:00
kernel_thread.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
local.h [PATCH] FRV: Fix FRV arch compile errors 2006-07-10 13:24:21 -07:00
module.c [PATCH] frv: add module support stubs 2006-01-08 20:13:37 -08:00
pm-mb93093.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
pm.c sysctl: simplify ->strategy 2008-10-16 11:21:47 -07:00
process.c FRV: Replace pgd management via slabs through quicklists 2007-05-09 12:30:46 -07:00
ptrace.c NOMMU: Make VMAs per MM as for MMU-mode linux 2009-01-08 12:04:47 +00:00
setup.c procfs: constify function pointer tables 2008-02-08 09:22:38 -08:00
signal.c Remove the macro get_personality 2008-04-29 08:06:02 -07:00
sleep.S Fix various old email addresses for dwmw2 2008-06-06 11:29:10 -07:00
switch_to.S FRV: Make NOMMU-mode work with base addresses other than 0xC0000000 [try #2] 2008-04-10 13:41:29 -07:00
sys_frv.c frv: fix mmap2 error handling 2008-12-01 19:55:24 -08:00
sysctl.c [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
time.c xtime_lock vs update_process_times 2008-02-13 13:29:25 -08:00
traps.c kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
uaccess.c [PATCH] frv: __user infrastructure 2006-06-23 07:42:54 -07:00
vmlinux.lds.S FRV: Drop the .data.idt section for FRV 2008-02-20 19:58:16 -08:00