linux-stable/arch
Andi Kleen 42d7395feb mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB
There was some desire in large applications using MAP_HUGETLB or
SHM_HUGETLB to use 1GB huge pages on some mappings, and stay with 2MB on
others.  This is useful together with NUMA policy: use 2MB interleaving
on some mappings, but 1GB on local mappings.

This patch extends the IPC/SHM syscall interfaces slightly to allow
specifying the page size.

It borrows some upper bits in the existing flag arguments and allows
encoding the log of the desired page size in addition to the *_HUGETLB
flag.  When 0 is specified the default size is used, this makes the
change fully compatible.

Extending the internal hugetlb code to handle this is straight forward.
Instead of a single mount it just keeps an array of them and selects the
right mount based on the specified page size.  When no page size is
specified it uses the mount of the default page size.

The change is not visible in /proc/mounts because internal mounts don't
appear there.  It also has very little overhead: the additional mounts
just consume a super block, but not more memory when not used.

I also exported the new flags to the user headers (they were previously
under __KERNEL__).  Right now only symbols for x86 and some other
architecture for 1GB and 2MB are defined.  The interface should already
work for all other architectures though.  Only architectures that define
multiple hugetlb sizes actually need it (that is currently x86, tile,
powerpc).  However tile and powerpc have user configurable hugetlb
sizes, so it's not easy to add defines.  A program on those
architectures would need to query sysfs and use the appropiate log2.

[akpm@linux-foundation.org: cleanups]
[rientjes@google.com: fix build]
[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hillf Danton <dhillf@gmail.com>
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>
2012-12-11 17:22:25 -08:00
..
alpha mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
arm Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
arm64 Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
avr32 Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux 2012-10-14 13:39:34 -07:00
blackfin Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux 2012-10-14 13:39:34 -07:00
c6x Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
cris Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux 2012-10-14 13:39:34 -07:00
frv frv: fix the broken preempt 2012-11-02 12:08:25 -04:00
h8300 h8300: add missing L1_CACHE_SHIFT 2012-11-09 06:41:47 +01:00
hexagon Hexagon: Copyright marking changes 2012-10-18 17:07:21 -05:00
ia64 revert "mm: fix-up zone present pages" 2012-11-16 14:33:04 -08:00
m32r Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux 2012-10-14 13:39:34 -07:00
m68k m68k: fix sigset_t accessor functions 2012-11-18 10:32:16 +01:00
microblaze Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
mips mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
mn10300 UAPI: Make arch/mn10300/include/uapi/asm/setup.h non-empty 2012-10-17 12:32:35 +01:00
openrisc Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
parisc mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
powerpc numa: convert static memory to dynamically allocated memory for per node device 2012-12-11 17:22:23 -08:00
s390 mm: add comment on storage key dirty bit semantics 2012-12-11 17:22:23 -08:00
score score: do_sigaltstack() expects a userland pointer... 2012-11-28 21:46:12 -05:00
sh sh64: fix altstack switching on sigreturn 2012-11-28 21:46:11 -05:00
sparc Device tree changes for v3.8 2012-12-11 11:30:41 -08:00
tile arch/tile: avoid build warnings from duplicate ELF_R_xxx #defines 2012-10-23 10:22:48 -04:00
um um: get_safe_registers() should be done in flush_thread(), not start_thread() 2012-11-28 21:46:03 -05:00
unicore32 arch/unicore32: remove CONFIG_EXPERIMENTAL 2012-11-09 17:30:10 +08:00
x86 mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
xtensa mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
.gitignore
Kconfig Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux 2012-10-14 13:39:34 -07:00