linux/drivers
Kirill A. Shutemov 461c7fa126 drivers/scsi/sg.c: mark VMA as VM_IO to prevent migration
Reduced testcase:

    #include <fcntl.h>
    #include <unistd.h>
    #include <sys/mman.h>
    #include <numaif.h>

    #define SIZE 0x2000

    int main()
    {
        int fd;
        void *p;

        fd = open("/dev/sg0", O_RDWR);
        p = mmap(NULL, SIZE, PROT_EXEC, MAP_PRIVATE | MAP_LOCKED, fd, 0);
        mbind(p, SIZE, 0, NULL, 0, MPOL_MF_MOVE);
        return 0;
    }

We shouldn't try to migrate pages in sg VMA as we don't have a way to
update Sg_scatter_hold::pages accordingly from mm core.

Let's mark the VMA as VM_IO to indicate to mm core that the VMA is not
migratable.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Shiraz Hashim <shashim@codeaurora.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-02-03 08:28:43 -08:00
..
accessibility
acpi Merge branches 'acpi-video' and 'acpi-hotplug' 2016-01-29 21:44:53 +01:00
amba
android
ata
atm
auxdisplay
base Driver core fix for 4.5-rc2 2016-01-31 16:55:04 -08:00
bcma
block Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2016-01-24 12:34:13 -08:00
bluetooth
bus
cdrom
char hwrng: stm32 - Fix dependencies for !HAS_IOMEM archs 2016-01-26 22:27:34 +08:00
clk
clocksource Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-31 15:49:06 -08:00
connector
cpufreq Merge branches 'pm-cpuidle', 'pm-cpufreq', 'pm-domains' and 'pm-sleep' 2016-01-29 21:45:17 +01:00
cpuidle Merge branches 'pm-cpuidle', 'pm-cpufreq', 'pm-domains' and 'pm-sleep' 2016-01-29 21:45:17 +01:00
crypto crypto: atmel-aes - remove calls of clk_prepare() from atomic contexts 2016-01-30 22:05:17 +08:00
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware
fmc
fpga
gpio
gpu Merge branch 'drm-rockchip-next-fixes-2016-01-22' of https://github.com/markyzq/kernel-drm-rockchip into drm-fixes 2016-01-29 10:04:29 +10:00
hid
hsi
hv
hwmon hwmon: (fam15h_power) Add bit masking for tdp_limit 2016-01-27 18:48:46 -08:00
hwspinlock
hwtracing
i2c i2c: piix4: don't regress on bus names 2016-01-29 11:13:52 +01:00
ide
idle
iio Staging fixes for 4.5-rc2 2016-01-31 17:00:27 -08:00
infiniband Initial roundup of 4.5 merge window patches 2016-01-23 18:45:06 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-01-22 17:20:30 -08:00
iommu iommu/amd: Correct the wrong setting of alias DTE in do_attach 2016-01-29 12:30:47 +01:00
ipack
irqchip Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-31 14:48:58 -08:00
isdn
leds
lguest
lightnvm
macintosh
mailbox
mcb
md Merge branch 'for-4.5/drivers' of git://git.kernel.dk/linux-block 2016-01-21 18:19:38 -08:00
media
memory
memstick
message
mfd
misc Merge branch 'akpm' (patches from Andrew) 2016-01-21 12:32:08 -08:00
mmc MMC core: 2016-01-22 12:04:21 -08:00
mtd Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-01-24 12:50:56 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-01 15:56:08 -08:00
nfc
ntb NTB: Fix macro parameter conflict with field name 2016-01-21 19:53:10 -05:00
nubus
nvdimm libnvdimm, pfn: fix restoring memmap location 2016-01-29 17:43:16 -08:00
nvme Merge branch 'for-4.5/nvme' of git://git.kernel.dk/linux-block 2016-01-21 19:58:02 -08:00
nvmem
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-01 15:56:08 -08:00
oprofile wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
parisc
parport
pci Merge branches 'acpi-video' and 'acpi-hotplug' 2016-01-29 21:44:53 +01:00
pcmcia
perf
phy
pinctrl
platform ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list 2016-01-24 10:15:01 -08:00
pnp
power
powercap
pps
ps3
ptp ptp: ixp46x: use helpers for converting ns to timespec 2016-01-29 12:38:59 -08:00
pwm pwm: Mark all devices as "might sleep" 2016-01-21 15:04:59 +01:00
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390 s390/cio: update measurement characteristics 2016-01-26 12:47:51 +01:00
sbus
scsi drivers/scsi/sg.c: mark VMA as VM_IO to prevent migration 2016-02-03 08:28:43 -08:00
sfi
sh
sn
soc ARM: SoC support for Tegra platforms for v4.5 2016-01-22 17:30:52 -08:00
spi
spmi
ssb
staging TTY/Serial fixes for 4.5-rc2 2016-01-31 17:09:39 -08:00
target Merge branch 'for-4.5/nvme' of git://git.kernel.dk/linux-block 2016-01-21 19:58:02 -08:00
tc
thermal Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2016-01-24 12:43:06 -08:00
thunderbolt
tty TTY/Serial fixes for 4.5-rc2 2016-01-31 17:09:39 -08:00
uio
usb USB-serial fixes for v4.5-rc2 2016-01-28 08:32:42 -08:00
uwb
vfio vfio/noiommu: Don't use iommu_present() to track fake groups 2016-01-27 11:22:25 -07:00
vhost
video wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
virt
virtio virtio_pci: fix use after free on release 2016-01-26 10:18:28 +02:00
vlynq
vme
w1
watchdog
xen Merge branch 'stable/for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/mm 2016-01-29 15:13:48 -08:00
zorro
Kconfig
Makefile