linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Richard Weinberger <richard@nod.at>,
	Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Hugh Dickins <hughd@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	toralf.foerster@gmx.de
Subject: [PATCH] mm: Fix force_flush behavior in zap_pte_range()
Date: Sun,  4 May 2014 01:37:27 +0200	[thread overview]
Message-ID: <1399160247-32093-1-git-send-email-richard@nod.at> (raw)
In-Reply-To: <alpine.LSU.2.11.1404161239320.6778@eggly.anvils>

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@redhat.com>
Reported-by: toralf.foerster@gmx.de
Cc: Dave Jones <davej@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Hugh Dickins <hughd@google.com> 
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: toralf.foerster@gmx.de
Signed-off-by: Richard Weinberger <richard@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, 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-05-03 23:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 19:09 [3.15rc1] BUG at mm/filemap.c:202! Dave Jones
2014-04-16 20:40 ` Hugh Dickins
2014-05-01 16:20   ` Richard Weinberger
2014-05-03 19:24     ` Richard Weinberger
2014-05-04 20:37       ` Hugh Dickins
2014-05-04 20:58         ` Richard Weinberger
2014-05-04 21:46           ` 502304919
2014-05-03 23:37   ` Richard Weinberger [this message]
2014-05-03 23:57     ` [PATCH] mm: Fix force_flush behavior in zap_pte_range() Linus Torvalds
2014-05-04  8:34       ` Richard Weinberger
2014-05-04 18:31         ` Linus Torvalds
2014-05-04 20:42           ` Richard Weinberger
2014-05-04 21:19             ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399160247-32093-1-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.com \
    --cc=toralf.foerster@gmx.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).