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
..
2016-01-06 21:43:09 -05:00
2016-01-08 12:51:04 -05:00
2015-11-09 17:11:57 -08:00
2015-11-12 07:06:18 -05:00
2015-11-12 07:06:18 -05:00
2016-01-07 15:51:13 -08:00
2015-11-12 07:06:18 -05:00
2015-11-13 20:35:54 -08:00
2015-11-13 20:35:54 -08:00
2015-04-27 10:10:19 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:05:55 -07:00
2015-11-09 17:11:57 -08:00
2015-12-03 09:32:33 -08:00
2015-04-17 10:13:56 -07:00
2015-11-25 22:08:55 -05:00
2016-01-06 21:43:09 -05:00
2015-07-31 13:31:10 +02:00
2014-07-17 22:07:37 +02:00
2016-01-06 21:43:09 -05:00
2015-11-09 17:11:57 -08:00
2014-11-24 16:13:16 +01:00
2015-11-09 16:32:14 -08:00
2016-01-06 21:43:13 -05:00
2016-01-06 21:43:13 -05:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2015-12-03 09:32:33 -08:00
2016-01-07 15:51:13 -08:00
2016-01-08 13:08:15 -05:00
2015-06-02 17:24:54 -07:00
2013-04-09 14:13:27 -04:00
2016-01-06 21:43:09 -05:00
2013-04-09 14:13:15 -04:00
2014-07-17 22:07:35 +02:00
2014-11-24 20:01:28 +01:00
2016-01-06 21:43:09 -05:00
2015-11-12 07:06:18 -05:00
2015-12-02 16:43:11 -05:00
2016-01-07 15:51:13 -08:00
2015-09-02 12:22:54 -07:00
2015-11-30 11:23:45 -05:00
2014-07-17 22:07:39 +02:00
2016-01-26 17:24:16 -08:00
2014-11-12 11:15:57 +01:00
2015-12-03 09:32:33 -08:00
2015-11-18 11:59:09 -05:00
2015-11-09 17:42:19 -08:00
2014-11-20 09:11:15 +01:00
2016-01-06 21:43:09 -05:00
2015-07-23 13:07:04 -07:00
2013-04-09 14:13:15 -04:00