linux-hardened/drivers
Hugh Dickins c01d5b3007 shmem: get_unmapped_area align huge page
Provide a shmem_get_unmapped_area method in file_operations, called at
mmap time to decide the mapping address.  It could be conditional on
CONFIG_TRANSPARENT_HUGEPAGE, but save #ifdefs in other places by making
it unconditional.

shmem_get_unmapped_area() first calls the usual mm->get_unmapped_area
(which we treat as a black box, highly dependent on architecture and
config and executable layout).  Lots of conditions, and in most cases it
just goes with the address that chose; but when our huge stars are
rightly aligned, yet that did not provide a suitable address, go back to
ask for a larger arena, within which to align the mapping suitably.

There have to be some direct calls to shmem_get_unmapped_area(), not via
the file_operations: because of the way shmem_zero_setup() is called to
create a shmem object late in the mmap sequence, when MAP_SHARED is
requested with MAP_ANONYMOUS or /dev/zero.  Though this only matters
when /proc/sys/vm/shmem_huge has been set.

Link: http://lkml.kernel.org/r/1466021202-61880-29-git-send-email-kirill.shutemov@linux.intel.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-07-26 16:19:19 -07:00
..
accessibility
acpi Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 19:15:35 -07:00
amba ARM: 8566/1: drivers: amba: properly handle devices with power domains 2016-05-05 19:00:40 +01:00
android
ata Merge branch 'for-4.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-07-23 11:46:59 +09:00
atm atm: iphase: off by one in rx_pkt() 2016-05-31 11:52:59 -07:00
auxdisplay
base mm, rmap: account shmem thp pages 2016-07-26 16:19:19 -07:00
bcma x86/quirks: Add early quirk to reset Apple AirPort card 2016-07-10 20:13:53 +02:00
block zram: use __GFP_MOVABLE for memory allocation 2016-07-26 16:19:19 -07:00
bluetooth Bluetooth: Add USB ID 13D3:3487 to ath3k 2016-05-13 16:54:59 +02:00
bus Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-05-19 10:02:26 -07:00
cdrom
char shmem: get_unmapped_area align huge page 2016-07-26 16:19:19 -07:00
clk clk: at91: fix clk_programmable_set_parent() 2016-07-18 17:45:41 -07:00
clocksource clocksource/drivers/time-armada-370-xp: Fix return value check 2016-07-12 17:33:22 +02:00
connector connector: fix out-of-order cn_proc netlink message delivery 2016-06-28 08:48:33 -04:00
cpufreq Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 20:43:12 -07:00
cpuidle cpuidle: Fix last_residency division 2016-07-04 14:17:34 +02:00
crypto crypto: qat - make qat_asym_algs.o depend on asn1 headers 2016-07-21 12:19:53 +08:00
dax /dev/dax, core: file operations and dax-mmap 2016-05-20 22:02:55 -07:00
dca
devfreq PM / devfreq: Send the DEVFREQ_POSTCHANGE notification when target() is failed 2016-06-23 23:15:12 +02:00
dio
dma dmaengine: hsu: Export hsu_dma_get_status() 2016-06-25 14:30:42 -07:00
dma-buf dma-buf: use vma_pages() 2016-05-31 22:17:05 +05:30
edac EDAC, sb_edac: Fix Knights Landing 2016-07-16 06:11:59 +09:00
eisa
extcon extcon: adc-jack: add suspend/resume support 2016-07-02 14:31:34 +09:00
firewire treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
firmware efi: Convert efi_call_virt() to efi_call_virt_pointer() 2016-06-27 13:06:56 +02:00
fmc
fpga
gpio gpio: tegra: don't auto-enable for COMPILE_TEST 2016-07-22 15:29:32 +02:00
gpu Merge tag 'topic/kbl-4.7-fixes-2016-07-18' of git://anongit.freedesktop.org/drm-intel into drm-fixes 2016-07-19 18:00:15 +10:00
hid HID: multitouch: enable palm rejection for Windows Precision Touchpad 2016-06-28 13:24:14 +02:00
hsi HSI: omap-ssi: move omap_ssi_port_update_fclk 2016-05-09 22:45:18 +02:00
hv Drivers: hv: balloon: reset host_specified_ha_region 2016-05-01 09:23:14 -07:00
hwmon hwmon: (ftsteutates) Remove unused including <linux/version.h> 2016-07-20 07:12:12 -07:00
hwspinlock drivers/hwspinlock: use correct radix tree API 2016-05-20 17:58:30 -07:00
hwtracing intel_th: Fixes -stable 2016-07-15 14:19:11 +09:00
i2c i2c: mux: reg: wrong condition checked for of_address_to_resource return value 2016-07-06 00:33:49 +09:00
ide
idle x86/intel_idle: Use Intel family macros for intel_idle 2016-06-08 13:03:25 +02:00
iio Third set of IIO new device support, features and cleanups for the 4.8 cycle. 2016-07-14 12:05:29 +09:00
infiniband i40iw: Enable remote access rights for stag allocation 2016-07-12 10:46:34 -04:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-07-23 12:10:48 +09:00
iommu mm: do not pass mm_struct into handle_mm_fault 2016-07-26 16:19:19 -07:00
ipack tty: Replace ASYNC_INITIALIZED bit and update atomically 2016-04-30 09:26:55 -07:00
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 21:35:03 -07:00
isdn TTY and Serial driver update for 4.7-rc1 2016-05-20 20:57:27 -07:00
leds leds: handle suspend/resume in heartbeat trigger 2016-06-08 11:47:06 +02:00
lguest
lightnvm lightnvm: reserved space calculation incorrect 2016-05-06 12:51:10 -06:00
macintosh powerpc/mm: Abstraction for switch_mmu_context() 2016-05-01 18:33:04 +10:00
mailbox mailbox: Fix devm_ioremap_resource error detection code 2016-05-08 22:44:46 +05:30
mcb mcb: Acquire reference to carrier module in core 2016-06-13 18:49:30 -07:00
md Merge branch 'for-linus' of git://git.kernel.dk/linux-block 2016-05-27 14:28:09 -07:00
media media: fix airspy usb probe error path 2016-07-16 06:15:40 +09:00
memory memory: omap-gpmc: Fix omap gpmc EXTRADELAY timing 2016-06-16 11:43:48 +03:00
memstick drivers/memstick/core/mspro_block: use kmemdup 2016-05-23 17:04:14 -07:00
message SCSI misc on 20160517 2016-05-18 16:38:59 -07:00
mfd mfd: max77620: Fix FPS switch statements 2016-06-30 07:44:23 +01:00
misc lkdtm: silence warnings about function declarations 2016-07-15 16:14:45 -07:00
mmc Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 20:43:12 -07:00
mtd Late MTD fix for v4.7: 2016-07-16 09:53:34 +09:00
net Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 20:43:12 -07:00
nfc NFC: pn533: handle interrupted commands in pn533_recv_frame 2016-05-10 00:01:47 +02:00
ntb
nubus
nvdimm libnvdimm, pfn, dax: fix initialization vs autodetect for mode + alignment 2016-06-23 17:50:39 -07:00
nvme nvme: Remove RCU namespace protection 2016-07-14 08:48:08 -07:00
nvmem nvmem: imx-ocotp: Fix assignment warning. 2016-06-25 07:42:55 -07:00
of drivers/of: Fix depth for sub-tree blob in unflatten_dt_nodes() 2016-06-09 14:36:34 -05:00
oprofile
parisc
parport parport: use subsys_initcall 2016-04-30 13:56:46 -07:00
pci Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 19:15:35 -07:00
pcmcia powerpc/mm: Use a helper for finding pte bits mapping I/O area 2016-05-01 18:32:32 +10:00
perf arm: pmu: Fix non-devicetree probing 2016-06-15 09:51:35 +01:00
phy phy: for 4.8 -rc1 2016-07-14 12:03:50 +09:00
pinctrl pinctrl: baytrail: Fix mingled clock pins 2016-06-23 11:05:04 +02:00
platform Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 19:15:35 -07:00
pnp x86/uaccess: Move thread_info::addr_limit to thread_struct 2016-07-15 10:26:30 +02:00
power Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 20:43:12 -07:00
powercap x86, powercap, rapl: Add Skylake Server model number 2016-06-08 13:03:25 +02:00
pps pps: do not crash when failed to register 2016-07-23 10:25:54 +09:00
ps3
ptp ptp: oops in ptp_ioctl() 2016-05-29 22:32:27 -07:00
pwm pwm: atmel-hlcdc: Fix default PWM polarity 2016-06-14 10:51:45 +02:00
rapidio rapidio/mport_cdev: fix uapi type definitions 2016-05-05 17:38:53 -07:00
ras
regulator regulator: Fix qcom-smd list voltage issues for msm8974 2016-07-13 04:22:16 +09:00
remoteproc remoteproc: Add additional crash reasons 2016-05-12 15:50:19 -07:00
reset
rpmsg rpmsg: add THIS_MODULE to rpmsg_driver in rpmsg core 2016-05-06 11:08:58 -07:00
rtc rtc: tps6586x: rename so module can be autoloaded 2016-05-21 17:07:17 +02:00
s390 qeth: delete napi struct when removing a qeth device 2016-07-04 23:32:08 -07:00
sbus openprom: fix warning 2016-05-20 18:33:37 -07:00
scsi Merge branch 'jejb-fixes' into fixes 2016-07-06 07:25:55 -07:00
sfi
sh drivers: sh: Stop using the legacy clock domain on ARM 2016-05-30 09:41:11 +09:00
sn
soc soc: mtk-pmic-wrap: avoid integer overflow warning 2016-05-19 15:20:24 +02:00
spi Merge remote-tracking branches 'spi/fix/ep93xx', 'spi/fix/rockchip', 'spi/fix/sunxi' and 'spi/fix/ti-qspi' into spi-linus 2016-06-30 13:17:29 +01:00
spmi spmi: do not use bus internal data 2016-04-30 14:15:56 -07:00
ssb
staging Third set of IIO new device support, features and cleanups for the 4.8 cycle. 2016-07-14 12:05:29 +09:00
target Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2016-05-28 12:04:17 -07:00
tc
thermal Merge branch 'x86/cpu' into x86/platform, to avoid conflict 2016-06-14 12:25:07 +02:00
thunderbolt thunderbolt: Fix double free of drom buffer 2016-05-02 12:09:22 -05:00
tty mm: oom: add memcg to oom_control 2016-07-26 16:19:19 -07:00
uio uio: add missing error codes 2016-05-01 14:11:12 -07:00
usb Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 20:43:12 -07:00
uwb
vfio vfio/pci: Allow VPD short read 2016-05-31 21:25:52 -06:00
vhost target: make close_session optional 2016-05-10 01:19:26 -07:00
video fbmon: remove unused function argument 2016-07-26 16:19:19 -07:00
virt
virtio mm: balloon: use general non-lru movable page feature 2016-07-26 16:19:19 -07:00
vlynq
vme vme: add vme_init_bridge for common bridge init 2016-05-01 14:00:00 -07:00
w1 w1: add ability to set (SRAM) and store (EEPROM) configuration for temp sensors like DS18B20 2016-05-01 14:37:49 -07:00
watchdog watchdog: ebc-c384_wdt: Allow build for X86_64 2016-06-17 20:21:12 -07:00
xen mm, frontswap: convert frontswap_enabled to static key 2016-07-26 16:19:19 -07:00
zorro
Kconfig libnvdimm for 4.7 2016-05-23 11:18:01 -07:00
Makefile drivers: sh: Stop using the legacy clock domain on ARM 2016-05-30 09:41:11 +09:00