parisc: keep track of last shared mmap'ed address

Because of parisc's cache aliasing constraints we need to map shared pages at a
multiple of 4MB while most other architectures can map files at any multiple of
PAGE_SIZE. In the past this constraint was ensured by calculating a virtual
offset into this 4MB region which is based on the physical address of the
kernel mapping variable (right-shift value of filp->f_mapping by 8 bits).
Since we only have a 32bit userspace (even when running on a 64bit kernel) this
often leads to large gaps in the maps of the userspace processes and to out of
memory situations even if physical memory was still free.  Of course I did
played with other variants of shifting the f_mapping value to find better
offsets but this didn't helped either.

This patch chooses a different approach.
It uses the private_data field of the file struct to store the last
used mmap address. With this bookkeeping it's possible for the parisc memory
allocator to
a) choose a mapping offset at any address if the file hasn't been mapped
yet, and
b) take the last-used mapping if it was already mapped by another process.

The flush_dcache_page() function now warns about INEQUIVALENT ALIASES
for shared mappings only and ignores private mappings. Without this
change, stracing applications sometimes showed those warnings.

Signed-off-by: Helge Deller <deller@gmx.de>
2 files changed