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 <da...@redhat.com>
Reported-by: toralf.foers...@gmx.de
Cc: Dave Jones <da...@redhat.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shute...@linux.intel.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: Sasha Levin <sasha.le...@oracle.com>
Cc: Hugh Dickins <hu...@google.com> 
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: toralf.foers...@gmx.de
Signed-off-by: Richard Weinberger <rich...@nod.at>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to