From: Matthew Wilcox <willy@infradead.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Hou Tao <houtao1@huawei.com>,
phillip@squashfs.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] squashfs: enable __GFP_FS in ->readpage to prevent hang in mem alloc
Date: Mon, 17 Dec 2018 06:41:01 -0800 [thread overview]
Message-ID: <20181217144101.GN10600@bombadil.infradead.org> (raw)
In-Reply-To: <20181217141044.GP30879@dhcp22.suse.cz>
On Mon, Dec 17, 2018 at 03:10:44PM +0100, Michal Hocko wrote:
> On Mon 17-12-18 04:25:46, Matthew Wilcox wrote:
> > It's worth noticing that squashfs _is_ in fact holding a page locked in
> > squashfs_copy_cache() when it calls grab_cache_page_nowait(). I'm not
> > sure if this will lead to trouble or not because I'm insufficiently
> > familiar with the reclaim path.
>
> Hmm, this is more interesting then. If there is any memcg accounted
> allocation down that path _and_ the squashfs writeout can lock more
> pages and mark them writeback before they are really sent to the storage
> then we have a problem. See [1]
>
> [1] http://lkml.kernel.org/r/20181213092221.27270-1-mhocko@kernel.org
Squashfs is read only, so it'll never have dirty pages and never do
writeout.
But ... maybe the GFP flags being used for grab_cache_page_nowait() are
wrong. It does, after all, say "nowait". Perhaps it shouldn't be trying
direct reclaim at all, but rather fail earlier. Like this:
+++ b/mm/filemap.c
@@ -1550,6 +1550,8 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
gfp_mask |= __GFP_WRITE;
if (fgp_flags & FGP_NOFS)
gfp_mask &= ~__GFP_FS;
+ if (fgp_flags & FGP_NOWAIT)
+ gfp_mask &= ~__GFP_DIRECT_RECLAIM;
page = __page_cache_alloc(gfp_mask);
if (!page)
next prev parent reply other threads:[~2018-12-17 14:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 2:08 Hou Tao
2018-12-06 1:14 ` Hou Tao
2018-12-13 2:18 ` Hou Tao
2018-12-15 13:24 ` Hou Tao
2018-12-15 14:38 ` Matthew Wilcox
2018-12-16 9:38 ` Hou Tao
2018-12-17 3:51 ` Matthew Wilcox
2018-12-17 9:33 ` Michal Hocko
2018-12-17 10:51 ` Tetsuo Handa
2018-12-17 12:25 ` Matthew Wilcox
2018-12-17 14:10 ` Michal Hocko
2018-12-17 14:41 ` Matthew Wilcox [this message]
2018-12-17 14:49 ` Michal Hocko
2018-12-18 6:06 ` Hou Tao
2018-12-18 11:32 ` Michal Hocko
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=20181217144101.GN10600@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=houtao1@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=phillip@squashfs.org.uk \
/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