From: Linus Torvalds <torvalds@linux-foundation.org>
To: Richard Weinberger <richard@nod.at>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>, "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>,
"Toralf Förster" <toralf.foerster@gmx.de>
Subject: Re: [PATCH] mm: Fix force_flush behavior in zap_pte_range()
Date: Sun, 4 May 2014 11:31:35 -0700 [thread overview]
Message-ID: <CA+55aFw9SLeE1fv1-nKMeB7o0YAFZ85mskYy_izCb7Nh3AiicQ@mail.gmail.com> (raw)
In-Reply-To: <5365FB8A.8080303@nod.at>
On Sun, May 4, 2014 at 1:34 AM, Richard Weinberger <richard@nod.at> wrote:
>
> Hmm, I got confused by:
> if (PageAnon(page))
> rss[MM_ANONPAGES]--;
> else {
> if (pte_dirty(ptent)) {
> force_flush = 1;
>
> Here you set force_flush.
Yes. And it needs to stay set, but we don't want to break out early.
The logic is:
- if the tlb removal page batching tables fill up, we need to stop
any further batching, and flush the TLB immediately, since we don't
have room for any more entries.
Thus that case does "force_flush=1" _and_ a "break" out of the loop.
- if we see dirty shared pages, we need to flush the TLB before we
release the page table lock, but we don't have to stop further
batching.
So this case just does "force_flush=1", but will continue to loop
over the page tables, since it can happily batch more pages.
> if (unlikely(!__tlb_remove_page(tlb, page))) {
> force_flush = 1;
> break;
> }
>
> And here it cannot get back to 0.
Correct. It *must* not go back to zero, because that would break the
"we had dirty pages, and more room to batch things".
> With your patch applied I see lots of BUG: Bad rss-counter state messages on UML (x86_32)
> when fuzzing with trinity the mremap syscall.
> And sometimes I face BUG at mm/filemap.c:202.
I'm suspecting that it's some UML bug that is triggered by the
changes. UML has its own tlb gather logic (I'm not quite sure why), I
wonder what's up.
Also, are the messages coming from UML or from the host kernel? I'm
assuming they are UML.
> After killing a trinity child I start observing the said issues.
>
> e.g.
> fix_range_common: failed, killing current process: 841
> fix_range_common: failed, killing current process: 842
> fix_range_common: failed, killing current process: 843
> BUG: Bad rss-counter state mm:28e69600 idx:0 val:2
That "idx=0" means that it's MM_FILEPAGES. Apparently the killing
ended up resulting in not freeing all the file mapping pte's.
So I'm assuming the real issue is that fix_range_common failure that
triggers this.
Exactly why the new tlb flushing triggers this is not entirely clear,
but I'd take a look at how UML reacts to the whole fact that a forced
flush (which never happened before, because your __tlb_remove_page()
doesn't batch anything up and always returns 1) updates the tlb
start/end fields as it does the tlb_flush_mmu_tlbonly().
Linus
--
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>
next prev parent reply other threads:[~2014-05-04 18:31 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 ` [PATCH] mm: Fix force_flush behavior in zap_pte_range() Richard Weinberger
2014-05-03 23:57 ` Linus Torvalds
2014-05-04 8:34 ` Richard Weinberger
2014-05-04 18:31 ` Linus Torvalds [this message]
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=CA+55aFw9SLeE1fv1-nKMeB7o0YAFZ85mskYy_izCb7Nh3AiicQ@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--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=richard@nod.at \
--cc=sasha.levin@oracle.com \
--cc=toralf.foerster@gmx.de \
/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