]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - mm/migrate.c
mm: Close races between THP migration and PMD numa clearing
authorMel Gorman <mgorman@suse.de>
Mon, 7 Oct 2013 10:28:46 +0000 (11:28 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Oct 2013 10:39:45 +0000 (12:39 +0200)
commita54a407fbf7735fd8f7841375574f5d9b0375f93
tree29a4af92708dfc99f1693e9a313b53474d50c496
parent8191acbd30c73e45c24ad16c372e0b42cc7ac8f8
mm: Close races between THP migration and PMD numa clearing

THP migration uses the page lock to guard against parallel allocations
but there are cases like this still open

  Task A Task B
  --------------------- ---------------------
  do_huge_pmd_numa_page do_huge_pmd_numa_page
  lock_page
  mpol_misplaced == -1
  unlock_page
  goto clear_pmdnuma
lock_page
mpol_misplaced == 2
migrate_misplaced_transhuge
  pmd = pmd_mknonnuma
  set_pmd_at

During hours of testing, one crashed with weird errors and while I have
no direct evidence, I suspect something like the race above happened.
This patch extends the page lock to being held until the pmd_numa is
cleared to prevent migration starting in parallel while the pmd_numa is
being cleared. It also flushes the old pmd entry and orders pagetable
insertion before rmap insertion.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1381141781-10992-9-git-send-email-mgorman@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
mm/huge_memory.c
mm/migrate.c