public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org, Petr Tuma <petr.tuma@d3s.mff.cuni.cz>,
	Brian Foster <bfoster@redhat.com>
Subject: Re: [PATCH] xfs: Timely free truncated dirty pages
Date: Wed, 11 Jan 2017 09:59:15 +0100	[thread overview]
Message-ID: <20170111085915.GD16116@quack2.suse.cz> (raw)
In-Reply-To: <7ecf901b-ecbd-3914-25c3-1f6f6faf3264@suse.cz>

Hi,

On Wed 11-01-17 09:07:51, Vlastimil Babka wrote:
> On 01/10/2017 11:17 AM, Jan Kara wrote:
> > Commit 99579ccec4e2 "xfs: skip dirty pages in ->releasepage()" started
> > to skip dirty pages in xfs_vm_releasepage() which also has the effect
> > that if a dirty page is truncated, it does not get freed by
> > block_invalidatepage() and is lingering in LRU list waiting for reclaim.
> > So a simple loop like:
> > 
> > while true; do
> > 	dd if=/dev/zero of=file bs=1M count=100
> > 	rm file
> > done
> > 
> > will keep using more and more memory until we hit low watermarks and
> > start pagecache reclaim which will eventually reclaim also the truncate
> > pages. Keeping these truncated (and thus never usable) pages in memory
> > is just a waste of memory, is unnecessarily stressing page cache
> > reclaim, and is also confusing users thinking they are running out of
> > memory.
> 
> So the impact is even worse than that, as it's the kernel that is
> actually confused, while the user still gets the impression of memory
> being available.
> According to the reporter, this bug has manifested as anonymous mmap()
> returning with ENOMEM in their workload (some benchmark), which does not
> happen anymore after switching from xfs to ext4.

OK, I've changed the changelog to contain:

... and reportedly also leads to anonymous mmap(2) returning ENOMEM
prematurely.

<snip>

> So this would explain the ENOMEM, and how this bug is a problem for
> workloads that truncate/remove files on xfs, and at the same time rely
> on anonymous mmap(). In that case, these mmaps can apparently start
> failing if there's no other source of sufficient memory pressure to let
> reclaim get rid of the truncated pages on LRU. This should be serious
> enough for a stable backport IMHO.

OK, added CC to stable.
	
								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      parent reply	other threads:[~2017-01-11  8:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 10:17 [PATCH] xfs: Timely free truncated dirty pages Jan Kara
2017-01-10 11:09 ` Vlastimil Babka
2017-01-10 12:43 ` Brian Foster
2017-01-11  8:57   ` Jan Kara
2017-01-11  8:07 ` Vlastimil Babka
2017-01-11  8:19   ` Vlastimil Babka
2017-01-11  8:59   ` Jan Kara [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=20170111085915.GD16116@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=petr.tuma@d3s.mff.cuni.cz \
    --cc=vbabka@suse.cz \
    /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