On 7/10/22 16:28, Nadav Amit wrote: > From: Nadav Amit <namit@xxxxxxxxxx> > > Commit aa44284960d5 ("x86/mm/tlb: Avoid reading mm_tlb_gen when > possible") introduced an optimization of skipping the flush if the TLB > generation that is flushed (as provided in flush_tlb_info) was already > flushed. > > However, arch_tlbbatch_flush() does not provide any generation in > flush_tlb_info. 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 confusions, > introduce TLB_GENERATION_INVALID constant and use it properly. Add some > assertions to check 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(). I've applied this: > https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/mm&id=8f1d56f64f8d6b80dea2d1978d10071132a695c5 Please double-check that my rewording of the commit message looks good to you. I also replaced the VM_BUG_ON()'s with warnings. Screwing up TLB flushing isn't great, but it's also not worth killing the system.