[PATCH 00/10] Alter NOMMU mmap handling [ver #3]

From: David Howells
Date: Thu Jan 08 2009 - 07:54:47 EST



The primary change made by the attached patches alters the NOMMU mmap code so
that VMAs are per-MM rather than being a shared resource with separate per-MM
linkage blocks.

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 even a dead process.

And adds a number of features:

(3) Allocations are now made with alloc_pages() rather than kmalloc(). This
simplifies page accounting within a block of pages.

(4) Excess pages can be trimmed from allocations.

(5) VMAs are added for the parent MM's RB-tree and mmap lists, as for MMU-mode
mmap.

(6) Non-anonymous VMAs can now be linked to the inode as for MMU-mode.

(7) mmaps can now be partially unmapped under some circumstances.

(8) Simplified coredumping in ELF-FDPIC.

(9) /proc/meminfo has a line "MmapCopy" that indicates the amount of private
copying mmap() has done.


There are some patches with secondary changes that do not relate to the primary
change:

(*) Ramfs needs to clean up correctly in the case where its get_unmapped_area
call gets fewer pages from find_get_pages() than were asked for.

(*) The askedalloc and realalloc variables are removed as nothing uses the
values computed.

(*) The ELF-FDPIC and FLAT binfmts no longer expand the stack segment to
consume the space that is allocated to them beyond what is asked for.
This removes some users of the contentious kobjsize().

An alternative method would be to to replace the call to kobjsize() with
something that uses the VMA list only.

(*) Fix kobjsize() to check the VMA list.

(*) Support XIP on initramfs under NOMMU conditions by pre-truncating the
ramfs files to get contiguous memory allocated in advance in the page
cache.


The patches can be obtained as a tarball from:

http://people.redhat.com/~dhowells/nommu-permmvmas.tar.bz2

And are available by GIT from:

git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-nommu.git

These patches have been tested on FRV, Blackfin and SH.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/