linux/arch/x86/include/asm
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
..
crypto crypto: move arch/x86/include/asm/aes.h to arch/x86/include/asm/crypto/ 2012-06-27 14:42:03 +08:00
numachip
uv Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-07-26 13:17:17 -07:00
visws
xen xen/hypercall: fix hypercall fallback code for very old hypervisors 2012-11-04 10:40:42 -05:00
a.out-core.h
a.out.h
acpi.h x86, realmode: Unbreak the ia64 build of drivers/acpi/sleep.c 2012-05-30 10:12:48 -07:00
agp.h
alternative-asm.h x86, alternative: Add header guards to <asm/alternative-asm.h> 2012-09-21 12:45:26 -07:00
alternative.h Merge branch 'x86-smap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-10-01 13:59:17 -07:00
amd_nb.h x86, MCE, AMD: Move shared bank to node descriptor 2012-06-07 12:43:44 +02:00
apb_timer.h
apic_flat_64.h
apic.h sections: fix section conflicts in arch/x86 2012-10-06 03:04:40 +09:00
apicdef.h x86/apic: Fix typo EIO_ACK -> EOI_ACK and document it 2012-05-18 09:46:07 +02:00
apm.h
arch_hweight.h
archrandom.h
asm-offsets.h
asm.h
atomic64_32.h atomic64_32.h: fix parameter naming mismatch 2012-05-09 11:38:20 +02:00
atomic64_64.h
atomic.h atomic: implement generic atomic_dec_if_positive() 2012-10-09 16:22:46 +09:00
auxvec.h
barrier.h
bios_ebda.h
bitops.h x86: Use REP BSF unconditionally 2012-09-19 17:26:08 +02:00
bitsperlong.h
boot.h
bootparam.h x86, efi: Handover Protocol 2012-07-20 16:18:58 -07:00
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
calgary.h
calling.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
ce4100.h
checksum_32.h
checksum_64.h
checksum.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
clocksource.h
cmpxchg_32.h
cmpxchg_64.h
cmpxchg.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
compat.h compat: move compat_siginfo_t definition to asm/compat.h 2012-10-06 03:05:16 +09:00
cpu_device_id.h
cpu.h
cpufeature.h UAPI: Partition the header include path sets and add uapi/ header directories 2012-10-02 18:01:26 +01:00
cpumask.h
cputime.h
current.h x86: replace percpu_xxx funcs with this_cpu_xxx 2012-05-14 14:15:31 -07:00
debugreg.h
delay.h
desc_defs.h
desc.h x86: replace percpu_xxx funcs with this_cpu_xxx 2012-05-14 14:15:31 -07:00
device.h
div64.h
dma-contiguous.h X86: integrate CMA with DMA-mapping subsystem 2012-05-21 15:09:38 +02:00
dma-mapping.h Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-05-25 09:18:59 -07:00
dma.h
dmi.h
dwarf2.h
e820.h
edac.h
efi.h EFI updates for 3.7 2012-10-26 10:17:38 +02:00
elf.h
emergency-restart.h x86-64, reboot: Allow reboot=bios and reboot-cpu override on x86-64 2012-06-17 10:51:01 -07:00
entry_arch.h x86/tlb: replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR 2012-06-27 19:29:13 -07:00
errno.h
exec.h
fb.h
fcntl.h
fixmap.h
floppy.h x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level> 2012-06-06 09:17:22 +02:00
fpu-internal.h x86, fpu: Avoid FPU lazy restore after suspend 2012-11-30 13:48:05 -08:00
frame.h
ftrace.h ftrace/x86: Add support for -mfentry to x86_64 2012-08-23 11:26:36 -04:00
futex.h x86, smap: Add STAC and CLAC instructions to control user space access 2012-09-21 12:45:27 -07:00
gart.h
genapic.h
geode.h
gpio.h gpiolib/arches: Centralise bolierplate asm/gpio.h 2012-05-11 18:00:14 -06:00
hardirq.h x86: Distinguish TLB shootdown interrupts from other functions call interrupts 2012-09-27 22:52:34 -07:00
highmem.h
hpet.h hpet: Remove unused PCI Vendor ID #define 2012-09-01 08:44:28 -07:00
hugetlb.h mm: hugetlb: add arch hook for clearing page flags before entering pool 2012-10-09 16:22:24 +09:00
hw_breakpoint.h
hw_irq.h
hypertransport.h
hyperv.h
hypervisor.h KVM: Add x86_hyper_kvm to complete detect_hypervisor_platform check 2012-07-11 19:33:32 +03:00
i387.h x86, kvm: fix kvm's usage of kernel_fpu_begin/end() 2012-09-21 16:59:04 -07:00
i8259.h
ia32_unistd.h
ia32.h compat: move compat_siginfo_t definition to asm/compat.h 2012-10-06 03:05:16 +09:00
idle.h
inat_types.h
inat.h
init.h
insn.h
inst.h
intel_scu_ipc.h
io_apic.h
io.h
ioctl.h
ioctls.h
iomap.h
iommu_table.h x86/iommu: Use NULL instead of plain 0 for __IOMMU_INIT 2012-09-05 10:52:26 +02:00
iommu.h iommu: Remove group_mf 2012-06-25 13:48:30 +02:00
ipcbuf.h
ipi.h
irq_regs.h x86: replace percpu_xxx funcs with this_cpu_xxx 2012-05-14 14:15:31 -07:00
irq_remapping.h
irq_vectors.h x86/tlb: replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR 2012-06-27 19:29:13 -07:00
irq.h
irqflags.h
ist.h
jump_label.h
kbdleds.h keyboard: Use BIOS Keyboard variable to set Numlock 2012-05-08 14:19:41 -07:00
Kbuild x86: Export asm/{svm.h,vmx.h,perf_regs.h} 2012-11-08 11:38:44 +00:00
kdebug.h x86: Avoid double stack traces with show_regs() 2012-05-09 11:44:42 +02:00
kexec.h
kgdb.h
kmap_types.h
kmemcheck.h
kprobes.h kprobes/x86: ftrace based optimization for x86 2012-07-31 10:29:59 -04:00
kvm_emulate.h KVM: emulator: optimize "rep ins" handling 2012-09-06 18:07:38 +03:00
kvm_host.h KVM updates for the 3.7 merge window 2012-10-04 09:30:33 -07:00
kvm_para.h x86: KVM guest: merge CONFIG_KVM_CLOCK into CONFIG_KVM_GUEST 2012-08-23 04:57:54 -03:00
kvm.h KVM updates for the 3.7 merge window 2012-10-04 09:30:33 -07:00
ldt.h
lguest_hcall.h
lguest.h
linkage.h
local64.h
local.h
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h
mce.h x86/mce: Provide boot argument to honour bios-set CMCI threshold 2012-09-27 10:08:00 -07:00
microcode.h x86, microcode: Add a refresh firmware flag to ->request_microcode_fw 2012-08-22 16:15:58 -07:00
mman.h mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB 2012-12-11 17:22:25 -08:00
mmconfig.h
mmu_context.h x86: replace percpu_xxx funcs with this_cpu_xxx 2012-05-14 14:15:31 -07:00
mmu.h
mmx.h
mmzone_32.h
mmzone_64.h
mmzone.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
module.h
mpspec_def.h MCA: delete all remaining traces of microchannel bus support. 2012-05-17 19:06:13 -04:00
mpspec.h MCA: delete all remaining traces of microchannel bus support. 2012-05-17 19:06:13 -04:00
mrst-vrtc.h
mrst.h
msgbuf.h
mshyperv.h
msidef.h
msr-index.h Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-10-13 10:20:11 +09:00
msr.h Merge branch 'x86/cpu' into perf/core 2012-07-05 21:12:11 +02:00
mtrr.h
mutex_32.h
mutex_64.h
mutex.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
mwait.h
nmi.h x86/nmi: Clean up register_nmi_handler() usage 2012-06-20 14:23:17 +02:00
nops.h
numa_32.h
numa_64.h
numa.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
numaq.h
olpc_ofw.h
olpc.h x86: OLPC: switch over to using new EC driver on x86 2012-07-31 23:27:30 -04:00
page_32_types.h
page_32.h
page_64_types.h
page_64.h
page_types.h
page.h
param.h
paravirt_types.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-07-26 13:17:17 -07:00
paravirt.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-07-26 13:17:17 -07:00
parport.h
pat.h
pci_64.h
pci_x86.h PCI changes for the 3.6 merge window: 2012-07-24 16:17:07 -07:00
pci-direct.h
pci-functions.h
pci.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
percpu.h x86: Define early read-mostly per-cpu macros 2012-06-14 12:42:10 +02:00
perf_event_p4.h
perf_event.h perf: Factor __output_copy to be usable with specific copy function 2012-08-10 11:44:06 -03:00
perf_regs.h perf: Unified API to record selective sets of arch registers 2012-08-10 11:21:37 -03:00
pgalloc.h
pgtable_32_types.h
pgtable_32.h mm: Add and use update_mmu_cache_pmd() in transparent huge page code. 2012-10-09 16:23:05 +09:00
pgtable_64_types.h
pgtable_64.h mm: Add and use update_mmu_cache_pmd() in transparent huge page code. 2012-10-09 16:23:05 +09:00
pgtable_types.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
pgtable-2level_types.h
pgtable-2level.h x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level> 2012-06-06 09:17:22 +02:00
pgtable-3level_types.h
pgtable-3level.h Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-07-22 12:04:44 -07:00
pgtable.h mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP 2012-10-09 16:22:57 +09:00
poll.h
posix_types_32.h bury __kernel_nlink_t, make internal nlink_t consistent 2012-05-30 21:04:50 -04:00
posix_types_64.h
posix_types_x32.h
posix_types.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
prctl.h
probe_roms.h
processor-cyrix.h
processor-flags.h x86, smap: Add CR4 bit for SMAP 2012-09-21 12:45:25 -07:00
processor.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-10-10 12:02:25 +09:00
prom.h
proto.h
ptrace-abi.h
ptrace.h x86-32: Fix invalid stack address while in softirq 2012-11-20 22:23:20 -08:00
pvclock-abi.h
pvclock.h
rcu.h x86: Use the new schedule_user API on userspace preemption 2012-09-26 15:47:12 +02:00
realmode.h x86-64, reboot: Allow reboot=bios and reboot-cpu override on x86-64 2012-06-17 10:51:01 -07:00
reboot_fixups.h
reboot.h x86-64, reboot: Allow reboot=bios and reboot-cpu override on x86-64 2012-06-17 10:51:01 -07:00
required-features.h
resource.h
resume-trace.h
rio.h
rtc.h
rwlock.h
rwsem.h
scatterlist.h
seccomp_32.h
seccomp_64.h
seccomp.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
sections.h
segment.h
sembuf.h
serial.h
setup_arch.h
setup.h
shmbuf.h
shmparam.h
sigcontext32.h
sigcontext.h
sigframe.h
sighandling.h most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set 2012-06-01 12:58:51 -04:00
siginfo.h
signal.h x86, signal: Cleanup ifdefs and is_ia32, is_x32 2012-09-18 15:51:26 -07:00
smap.h x86, smap: Add STAC and CLAC instructions to control user space access 2012-09-21 12:45:27 -07:00
smp.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-07-26 13:17:17 -07:00
smpboot_hooks.h
socket.h
sockios.h
sparsemem.h
special_insns.h
spinlock_types.h
spinlock.h x86/spinlocks: Fix comment in spinlock.h 2012-08-22 09:52:47 +02:00
sta2x11.h mfd: Add driver for STA2X11 MFD block 2012-05-09 15:34:28 +02:00
stackprotector.h x86: replace percpu_xxx funcs with this_cpu_xxx 2012-05-14 14:15:31 -07:00
stacktrace.h
stat.h
statfs.h
string_32.h
string_64.h
string.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
suspend_32.h
suspend_64.h
suspend.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
svm.h KVM: x86: Export svm/vmx exit code and vector code to userspace 2012-09-21 12:48:09 -03:00
swab.h
swiotlb.h
switch_to.h
sync_bitops.h
sys_ia32.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-10-10 12:02:25 +09:00
syscall.h
syscalls.h x86, um/x86: switch to generic sys_execve and kernel_execve 2012-09-30 22:53:32 -04:00
tce.h
termbits.h
termios.h
thread_info.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-10-10 12:02:25 +09:00
time.h
timer.h
timex.h
tlb.h x86/tlb: enable tlb flush range support for x86 2012-06-27 19:29:11 -07:00
tlbflush.h x86/tlb: Fix build warning and crash when building for !SMP 2012-07-20 15:01:48 -07:00
topology.h sched/numa: Rewrite the CONFIG_NUMA sched domain support 2012-05-09 15:00:55 +02:00
traps.h
tsc.h
types.h
uaccess_32.h x86, uaccess: Merge prototypes for clear_user/__clear_user 2012-09-21 12:45:26 -07:00
uaccess_64.h x86, uaccess: Merge prototypes for clear_user/__clear_user 2012-09-21 12:45:26 -07:00
uaccess.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
ucontext.h
unaligned.h
unistd.h x86, um: convert to saner kernel_execve() semantics 2012-10-12 13:35:22 -04:00
uprobes.h uprobes: Make arch_uprobe_task->saved_trap_nr "unsigned int" 2012-09-15 17:37:32 +02:00
user32.h
user_32.h
user_64.h
user.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
vdso.h x86/vdso: Add __user annotation to VDSO32_SYMBOL 2012-09-05 10:52:23 +02:00
vga.h
vgtod.h time: Convert x86_64 to using new update_vsyscall 2012-09-24 12:38:09 -04:00
virtext.h
vm86.h
vmx.h KVM: x86: Export svm/vmx exit code and vector code to userspace 2012-09-21 12:48:09 -03:00
vsyscall.h
vvar.h
word-at-a-time.h word-at-a-time: make the interfaces truly generic 2012-05-26 11:33:40 -07:00
x2apic.h x86/apic: Factor out default target_cpus() operation 2012-06-06 10:22:17 +02:00
x86_init.h x86: Document x86_init.paging.pagetable_init() 2012-09-12 15:33:07 +02:00
xcr.h
xor_32.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
xor_64.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
xor_avx.h x86, fpu: always use kernel_fpu_begin/end() for in-kernel FPU usage 2012-09-18 15:52:08 -07:00
xor.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
xsave.h Merge branch 'x86/fpu' into x86/smap 2012-09-21 17:18:44 -07:00