Skip to content
  • Naoya Horiguchi's avatar
    mm: thp: move pmd check inside ptl for freeze_page() · 33f4751e
    Naoya Horiguchi authored
    I found a race condition triggering VM_BUG_ON() in freeze_page(), when
    running a testcase with 3 processes:
      - process 1: keep writing thp,
      - process 2: keep clearing soft-dirty bits from virtual address of process 1
      - process 3: call migratepages for process 1,
    
    The kernel message is like this:
    
      kernel BUG at /src/linux-dev/mm/huge_memory.c:3096!
      invalid opcode: 0000 [#1] SMP
      Modules linked in: cfg80211 rfkill crc32c_intel ppdev serio_raw pcspkr virtio_balloon virtio_console parport_pc parport pvpanic acpi_cpufreq tpm_tis tpm i2c_piix4 virtio_blk virtio_net ata_generic pata_acpi floppy virtio_pci virtio_ring virtio
      CPU: 0 PID: 28863 Comm: migratepages Not tainted 4.6.0-v4.6-160602-0827-+ #2
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      task: ffff880037320000 ti: ffff88007cdd0000 task.ti: ffff88007cdd0000
      RIP: 0010:[<ffffffff811f8e06>]  [<ffffffff811f8e06>] split_huge_page_to_list+0x496/0x590
      RSP: 0018:ffff88007cdd3b70  EFLAGS: ...
    33f4751e