From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by kanga.kvack.org (Postfix) with ESMTP id 65C816B0036 for ; Sat, 3 May 2014 19:37:53 -0400 (EDT) Received: by mail-ee0-f49.google.com with SMTP id e53so4144767eek.22 for ; Sat, 03 May 2014 16:37:52 -0700 (PDT) Received: from mail.sigma-star.at (mail.sigma-star.at. [95.130.255.111]) by mx.google.com with ESMTP id x46si5839125eea.89.2014.05.03.16.37.51 for ; Sat, 03 May 2014 16:37:51 -0700 (PDT) From: Richard Weinberger Subject: [PATCH] mm: Fix force_flush behavior in zap_pte_range() Date: Sun, 4 May 2014 01:37:27 +0200 Message-Id: <1399160247-32093-1-git-send-email-richard@nod.at> In-Reply-To: References: Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Richard Weinberger , Dave Jones , Andrew Morton , "Kirill A. Shutemov" , Johannes Weiner , Sasha Levin , Hugh Dickins , Linus Torvalds , toralf.foerster@gmx.de 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 Reported-by: toralf.foerster@gmx.de Cc: Dave Jones Cc: Andrew Morton Cc: "Kirill A. Shutemov" Cc: Johannes Weiner Cc: Sasha Levin Cc: Hugh Dickins Cc: Linus Torvalds Cc: toralf.foerster@gmx.de Signed-off-by: Richard Weinberger --- 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@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org