Skip to content

Commit

Permalink
madvise_free, thp: fix madvise_free_huge_pmd return value after split…
Browse files Browse the repository at this point in the history
…ting

madvise_free_huge_pmd should return 0 if the fallback PTE operations are
required.  In madvise_free_huge_pmd, if part pages of THP are discarded,
the THP will be split and fallback PTE operations should be used if
splitting succeeds.  But the original code will make fallback PTE
operations skipped, after splitting succeeds.  Fix that via make
madvise_free_huge_pmd return 0 after splitting successfully, so that the
fallback PTE operations will be done.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Acked-by: Minchan Kim <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Jerome Marchand <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Ebru Akagunduz <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
yhuang-intel authored and torvalds committed Jul 15, 2016
1 parent ef722fd commit 9818b8c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,14 +1624,9 @@ int madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
if (next - addr != HPAGE_PMD_SIZE) {
get_page(page);
spin_unlock(ptl);
if (split_huge_page(page)) {
put_page(page);
unlock_page(page);
goto out_unlocked;
}
split_huge_page(page);
put_page(page);
unlock_page(page);
ret = 1;
goto out_unlocked;
}

Expand Down

0 comments on commit 9818b8c

Please sign in to comment.