public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, fstests <fstests@vger.kernel.org>
Subject: Re: Any method to limit page cache usage in test cases?
Date: Wed, 14 Nov 2018 15:32:43 +0800	[thread overview]
Message-ID: <b6b4b87d-e10c-ebd6-b36a-591ccb06775c@gmx.com> (raw)
In-Reply-To: <af32c900-1fd4-3440-7e96-ac189c4d9f9e@suse.com>



On 2018/11/14 下午3:21, Nikolay Borisov wrote:
> 
> 
> On 14.11.18 г. 9:17 ч., Qu Wenruo wrote:
>>
>>
>> On 2018/11/14 下午3:00, Qu Wenruo wrote:
>>>
>>>
>>> On 2018/11/14 下午2:47, Nikolay Borisov wrote:
>>>>
>>>>
>>>> On 14.11.18 г. 2:31 ч., 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.
>>>>
>>>> You can always size your test vm properly. Otherwise what about the
>>>> various sysctl tuning knobs? I.e Documentation/sysctl/vm.txt explains
>>>> some of them: dirty_bytes, dirty_background_bytes,
>>>> dirty_background_ratio, dirty_expire_centisecs
>>>
>>> Thanks for the hint about vm.txt!
>>>
>>> I just realized we could just drop_caches to force dirty page writeback,
>>> without the need to tweaking the complex memory pressure/watermark
>>> mechanism.
>>
>> Well, this doesn't work as expected.
>>
>> It will cause transaction commit, seems that kernel is trying too hard
>> to free page cache.
>>
>> Is there any way to only flush dirty pages of a file?
> 
> well fdatasync causes ->fsync to run, in btrfs that will be
> btrfs_sync_file.

Yes, that's the why we can't use fsync()/fdatasync(), and I'm trying to
use drop_caches.

> One of the first thing it does is start_ordered_ops
> which does btrfs_fdatawrite_range, which in turn is filemap_fdatawrite_range

So I'm afraid I have to go the complex memory pressure/watermark method.

Thanks,
Qu

> 
> 
>>
>> Thanks,
>> Qu
>>
>>>
>>> Thanks,
>>> Qu
>>>>
>>>>
>>>> So with a 2g machine the default settings are using only a fraction of
>>>> the ram. If you adjust the same settings for the larger ram size you
>>>> should get almost identical behavior.>
>>>>
>>>>
>>>>>
>>>>> 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.
>>>>>
>>>>> Thanks,
>>>>> Qu
>>>>>
>>

  reply	other threads:[~2018-11-14 17:34 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 [this message]
2018-11-15  5:31 ` Dave Chinner

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=b6b4b87d-e10c-ebd6-b36a-591ccb06775c@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=fstests@vger.kernel.org \
    --cc=nborisov@suse.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