Skip to content

Commit c3a489c

Browse files
Mel Gormantorvalds
authored andcommitted
mm: numa: ensure anon_vma is locked to prevent parallel THP splits
The anon_vma lock prevents parallel THP splits and any associated complexity that arises when handling splits during THP migration. This patch checks if the lock was successfully acquired and bails from THP migration if it failed for any reason. Signed-off-by: Mel Gorman <mgorman@suse.de> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Alex Thorlton <athorlton@sgi.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0c5f83c commit c3a489c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mm/huge_memory.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,13 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
13591359
goto out_unlock;
13601360
}
13611361

1362+
/* Bail if we fail to protect against THP splits for any reason */
1363+
if (unlikely(!anon_vma)) {
1364+
put_page(page);
1365+
page_nid = -1;
1366+
goto clear_pmdnuma;
1367+
}
1368+
13621369
/*
13631370
* Migrate the THP to the requested node, returns with page unlocked
13641371
* and pmd_numa cleared.

0 commit comments

Comments
 (0)