Skip to content

Commit

Permalink
thp: fix memory-failure hugetlbfs vs THP collision
Browse files Browse the repository at this point in the history
hugetlbfs was changed to allow memory failure to migrate the hugetlbfs
pages and that broke THP as split_huge_page was then called on hugetlbfs
pages too.

compound_head/order was also run unsafe on THP pages that can be splitted
at any time.

All compound_head() invocations in memory-failure.c that are run on pages
that aren't pinned and that can be freed and reused from under us (while
compound_head is running) are buggy because compound_head can return a
dangling pointer, but I'm not fixing this as this is a generic
memory-failure bug not specific to THP but it applies to hugetlbfs too, so
I can fix it later after THP is merged upstream.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrea Arcangeli authored and Linus Torvalds committed Jan 14, 2011
1 parent 14d1a55 commit 91600e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
struct task_struct *tsk;
struct anon_vma *av;

if (unlikely(split_huge_page(page)))
if (!PageHuge(page) && unlikely(split_huge_page(page)))
return;
read_lock(&tasklist_lock);
av = page_lock_anon_vma(page);
Expand Down
2 changes: 1 addition & 1 deletion mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ int try_to_unmap(struct page *page, enum ttu_flags flags)
int ret;

BUG_ON(!PageLocked(page));
BUG_ON(PageTransHuge(page));
VM_BUG_ON(!PageHuge(page) && PageTransHuge(page));

if (unlikely(PageKsm(page)))
ret = try_to_unmap_ksm(page, flags);
Expand Down

0 comments on commit 91600e9

Please sign in to comment.