public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: fstests <fstests@vger.kernel.org>
Subject: Re: Any method to limit page cache usage in test cases?
Date: Thu, 15 Nov 2018 16:31:15 +1100	[thread overview]
Message-ID: <20181115053115.GK6311@dastard> (raw)
In-Reply-To: <55b117b2-f683-7754-dbf6-232efbd617de@gmx.com>

On Wed, Nov 14, 2018 at 08:31:05AM +0800, Qu Wenruo wrote:
> Hi,
> 
> Is there any (easy) method for a fstests test case to limit the page
> cache usage?
> 
> I triggered btrfs/139 failure with 2G vRAM VM, and located the root
> cause of the problem.
> 
> However it's only really reproducible for small ram VM, since it could
> trigger dirty page writeback due to memory pressure.
> 
> So I'm wondering if we could do such thing even for large RAM test machine.

src/usemem.c can currently be used to consume up to 2GB of RAM.

Update it to deal with amounts of more than 2^31 bytes, and then
calculate how much ram you want to lock away as unusable in the test
and call usemem to prevent the kernel from using than memory.

It's an easy way to drive the kernel into severe memory shortages
and trigger dirty page writeback from memory reclaim....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      parent reply	other threads:[~2018-11-15 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14  0:31 Any method to limit page cache usage in test cases? Qu Wenruo
2018-11-14  6:47 ` Nikolay Borisov
2018-11-14  7:00   ` Qu Wenruo
2018-11-14  7:17     ` Qu Wenruo
2018-11-14  7:21       ` Nikolay Borisov
2018-11-14  7:32         ` Qu Wenruo
2018-11-15  5:31 ` Dave Chinner [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=20181115053115.GK6311@dastard \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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