Commit 1cf35d47 (mm: split 'tlb_flush_mmu()' into tlb flushing and memory freeing parts) accidently changed the behavior of the force_flush variable. Before the patch it was set by __tlb_remove_page(). Now it is only set to 1 if __tlb_remove_page() returns false but never set back to 0 if __tlb_remove_page() returns true. And therefore the flush happens now too often. This patch restores the old behavior. Fixes BUG: Bad rss-counter state ... and kernel BUG at mm/filemap.c:202! Reported-by: Dave Jones <davej@xxxxxxxxxx> Reported-by: toralf.foerster@xxxxxx Cc: Dave Jones <davej@xxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Sasha Levin <sasha.levin@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: toralf.foerster@xxxxxx Signed-off-by: Richard Weinberger <richard@xxxxxx> --- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 037b812..585885b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1148,10 +1148,10 @@ again: page_remove_rmap(page); if (unlikely(page_mapcount(page) < 0)) print_bad_pte(vma, addr, ptent, page); - if (unlikely(!__tlb_remove_page(tlb, page))) { - force_flush = 1; + force_flush = !__tlb_remove_page(tlb, page); + if (force_flush) break; - } + continue; } /* -- 1.8.1.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>