]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
powerpc/book3s64/radix/tlb: Determine hugepage flush correctly
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Wed, 13 May 2020 03:06:16 +0000 (08:36 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 20 May 2020 13:39:55 +0000 (23:39 +1000)
With a 64K page size flush with start and end:

  (start, end) = (721f680d0000721f680e0000)

results in:

  (hstart, hend) = (721f68200000721f68000000)

ie. hstart is above hend, which indicates no huge page flush is
needed.

However the current logic incorrectly sets hflush = true in this case,
because hstart != hend.

That causes us to call __tlbie_va_range() passing hstart/hend, to do a
huge page flush even though we don't need to. __tlbie_va_range() will
skip the actual tlbie operation for start > end. But it will still end
up calling fixup_tlbie_va_range() and doing the TLB fixups in there,
which is harmless but unnecessary work.

Reported-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Drop else case, hflush is already false, flesh out change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200513030616.152288-1-aneesh.kumar@linux.ibm.com
arch/powerpc/mm/book3s64/radix_tlb.c

index 758ade2c2b6ed3e246707398a649404e88de7df6..b5cc9b23cf0248fc655c01a2f1866d26e4d14ee2 100644 (file)
@@ -884,9 +884,7 @@ is_local:
                if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
                        hstart = (start + PMD_SIZE - 1) & PMD_MASK;
                        hend = end & PMD_MASK;
-                       if (hstart == hend)
-                               hflush = false;
-                       else
+                       if (hstart < hend)
                                hflush = true;
                }