linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Hugh Dickins <hughd@google.com>
Cc: Linux MM <linux-mm@kvack.org>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Yang Shi <shy828301@gmail.com>
Subject: Re: Is shmem page accounting wrong on split?
Date: Fri, 28 Aug 2020 19:01:40 +0100	[thread overview]
Message-ID: <20200828180140.GQ14765@casper.infradead.org> (raw)
In-Reply-To: <20200828173122.GP14765@casper.infradead.org>

On Fri, Aug 28, 2020 at 06:31:22PM +0100, Matthew Wilcox wrote:
> On Fri, Aug 28, 2020 at 10:08:52AM -0700, Hugh Dickins wrote:
> > It's a good observation of an oddity that I probably didn't think of,
> > but you haven't said which kind of shmem page accounting goes wrong here
> > (vm_enough_memory? df of filesystem? du of filesystem? memcg charge?
> > all of the above? observed in practice?), and what needs solving.

Oh, I forgot to say which 

> The problem I've observed in practice is following the same pattern in
> truncate_inode_pages_range().  The call to delete_from_page_cache_batch()
> trips the assertion that the page hasn't already been deleted from the
> page cache.  I think the solution is obvious -- don't add the page to
> locked_pvec if page->mapping is NULL.

Here's the change I'm currently testing.  It's survived about eight
minutes of xfstests so far, which is far longer than it was surviving
before.

-       /* Try to split huge page, so we can truly punch the hole or truncate */
-       return split_huge_page(page) >= 0;
+       /*
+        * split_huge_page may remove the page itself; if so, we should
+        * not attempt to remove it again.
+        */
+       return split_huge_page(page) >= 0 && page->mapping;



      reply	other threads:[~2020-08-28 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 14:25 Matthew Wilcox
2020-08-28 14:55 ` Matthew Wilcox
2020-08-28 15:43   ` Yang Shi
2020-08-28 17:08     ` Hugh Dickins
2020-08-28 17:31       ` Matthew Wilcox
2020-08-28 18:01         ` Matthew Wilcox [this message]

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=20200828180140.GQ14765@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=yang.shi@linux.alibaba.com \
    /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