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 <[email protected]>
Reported-by: [email protected]
Cc: Dave Jones <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]> 
Cc: Linus Torvalds <[email protected]>
Cc: [email protected]
Signed-off-by: Richard Weinberger <[email protected]>
---
 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 [email protected]
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