Commit ba68bc01 authored by Mel Gorman's avatar Mel Gorman Committed by Linus Torvalds

mm: thp: Return the correct value for change_huge_pmd

The wrong value is being returned by change_huge_pmd since commit
10c1045f ("mm: numa: avoid unnecessary TLB flushes when setting
NUMA hinting entries") which allows a fallthrough that tries to adjust
non-existent PTEs. This patch corrects it.
Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 09d35919
...@@ -1487,6 +1487,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, ...@@ -1487,6 +1487,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) { if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
pmd_t entry; pmd_t entry;
ret = 1;
/* /*
* Avoid trapping faults against the zero page. The read-only * Avoid trapping faults against the zero page. The read-only
...@@ -1495,11 +1496,10 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, ...@@ -1495,11 +1496,10 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
*/ */
if (prot_numa && is_huge_zero_pmd(*pmd)) { if (prot_numa && is_huge_zero_pmd(*pmd)) {
spin_unlock(ptl); spin_unlock(ptl);
return 0; return ret;
} }
if (!prot_numa || !pmd_protnone(*pmd)) { if (!prot_numa || !pmd_protnone(*pmd)) {
ret = 1;
entry = pmdp_get_and_clear_notify(mm, addr, pmd); entry = pmdp_get_and_clear_notify(mm, addr, pmd);
entry = pmd_modify(entry, newprot); entry = pmd_modify(entry, newprot);
ret = HPAGE_PMD_NR; ret = HPAGE_PMD_NR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment