mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
mm: add !pte_present() check on existing hugetlb_entry callbacks
The age table walker doesn't check non-present hugetlb entry in common path, so hugetlb_entry() callbacks must check it. The reason for this behavior is that some callers want to handle it in its own way. [ I think that reason is bogus, btw - it should just do what the regular code does, which is to call the "pte_hole()" function for such hugetlb entries - Linus] However, some callers don't check it now, which causes unpredictable result, for example when we have a race between migrating hugepage and reading /proc/pid/numa_maps. This patch fixes it by adding !pte_present checks on buggy callbacks. This bug exists for years and got visible by introducing hugepage migration. ChangeLog v2: - fix if condition (check !pte_present() instead of pte_present()) Reported-by: Sasha Levin <[email protected]> Signed-off-by: Naoya Horiguchi <[email protected]> Cc: Rik van Riel <[email protected]> Cc: <[email protected]> [3.12+] Signed-off-by: Andrew Morton <[email protected]> [ Backported to 3.15. Signed-off-by: Josh Boyer <[email protected]> ] Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d54d14bfb4
commit
d4c54919ed
2 changed files with 6 additions and 2 deletions
|
|
@ -1351,7 +1351,7 @@ static int gather_hugetbl_stats(pte_t *pte, unsigned long hmask,
|
|||
struct numa_maps *md;
|
||||
struct page *page;
|
||||
|
||||
if (pte_none(*pte))
|
||||
if (!pte_present(*pte))
|
||||
return 0;
|
||||
|
||||
page = pte_page(*pte);
|
||||
|
|
|
|||
Loading…
Reference in a new issue