Skip to content

Commit ba68bc0

Browse files
Mel Gormantorvalds
authored andcommitted
mm: thp: Return the correct value for change_huge_pmd
The wrong value is being returned by change_huge_pmd since commit 10c1045 ("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: Mel Gorman <mgorman@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 09d3591 commit ba68bc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/huge_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
14871487

14881488
if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
14891489
pmd_t entry;
1490+
ret = 1;
14901491

14911492
/*
14921493
* 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,
14951496
*/
14961497
if (prot_numa && is_huge_zero_pmd(*pmd)) {
14971498
spin_unlock(ptl);
1498-
return 0;
1499+
return ret;
14991500
}
15001501

15011502
if (!prot_numa || !pmd_protnone(*pmd)) {
1502-
ret = 1;
15031503
entry = pmdp_get_and_clear_notify(mm, addr, pmd);
15041504
entry = pmd_modify(entry, newprot);
15051505
ret = HPAGE_PMD_NR;

0 commit comments

Comments
 (0)