diff options
author | Nadav Amit <[email protected]> | 2022-07-10 16:28:37 -0700 |
---|---|---|
committer | Dave Hansen <[email protected]> | 2022-07-19 09:04:52 -0700 |
commit | 8f1d56f64f8d6b80dea2d1978d10071132a695c5 (patch) | |
tree | c2cdb5350b9b76f53f5e9ee653d47b16ca9dbac1 /lib/mpi/mpi-sub-ui.c | |
parent | 54ee1844047c1df015ab2679a4f55564a3aa1fa1 (diff) |
x86/mm/tlb: Ignore f->new_tlb_gen when zero
Commit aa44284960d5 ("x86/mm/tlb: Avoid reading mm_tlb_gen when
possible") introduced an optimization to skip superfluous TLB
flushes based on the generation provided in flush_tlb_info.
However, arch_tlbbatch_flush() does not provide any generation in
flush_tlb_info and populates the flush_tlb_info generation with
0. This 0 is causes the flush_tlb_info to be interpreted as a
superfluous, old flush. As a result, try_to_unmap_one() would
not perform any TLB flushes.
Fix it by checking whether f->new_tlb_gen is nonzero. Zero value
is anyhow is an invalid generation value. To avoid future
confusion, introduce TLB_GENERATION_INVALID constant and use it
properly. Add warnings to ensure no partial flushes are done with
TLB_GENERATION_INVALID or when f->mm is NULL, since this does not
make any sense.
In addition, add the missing unlikely().
[ dhansen: change VM_BUG_ON() -> VM_WARN_ON(), clarify changelog ]
Fixes: aa44284960d5 ("x86/mm/tlb: Avoid reading mm_tlb_gen when possible")
Reported-by: Hugh Dickins <[email protected]>
Signed-off-by: Nadav Amit <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Tested-by: Hugh Dickins <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions