All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Michal Hocko <mhocko@suse.com>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: print a warning once the vm dirtiness settings is illogical
Date: Sun, 26 Nov 2017 16:27:02 +0800	[thread overview]
Message-ID: <CALOAHbAXLT0iztU+1gsVwEm715RWYNnDXu=JJK6jjwSEt6KmNw@mail.gmail.com> (raw)
In-Reply-To: <201711261703.HDI52138.JSFVOFOtHLMOFQ@I-love.SAKURA.ne.jp>

2017-11-26 16:03 GMT+08:00 Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>:
> Yafang Shao wrote:
>> >> I have also verified your test code on my machine, but can not find
>> >> this message.
>> >>
>> >
>> > Not always printed. It is timing dependent.
>> >
>>
>> I will try and analysis why this happen.
>>
> I see.
>
> Here is dump of variables. Always mostly 0 when this happens.
>
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -434,7 +434,8 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc)
>                 bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE;
>
>         if (unlikely(bg_thresh >= thresh)) {
> -               pr_warn("vm direct limit must be set greater than background limit.\n");
> +               pr_warn("vm direct limit must be set greater than background limit. bg_thresh=%lu thresh=%lu bg_bytes=%lu bytes=%lu bg_ratio=%lu ratio=%lu gdtc=%p gdtc->vail=%lu vm_dirty_bytes=%lu dirty_background_bytes=%lu\n",
> +                       bg_thresh, thresh, bg_bytes, bytes, bg_ratio, ratio, gdtc, gdtc ? gdtc->avail : 0UL, vm_dirty_bytes, dirty_background_bytes);
>                 bg_thresh = thresh / 2;
>         }
>
> [  259.641324] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  317.798913] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  317.798935] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  317.976210] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  417.781194] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  466.322615] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  466.322618] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  466.497893] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0
> [  466.504687] vm direct limit must be set greater than background limit. bg_thresh=0 thresh=0 bg_bytes=0 bytes=0 bg_ratio=409 ratio=1228 gdtc=          (null) gdtc->vail=0 vm_dirty_bytes=0 dirty_background_bytes=0

Hi Tetsuo,

Bellow is the code analysis,
     // global_dirtyable_memory() will return number of globally dirtyable page
    gdtc.avail = global_dirtyable_memory();
    domain_dirty_limits(&gdtc);
        unsigned long ratio = (vm_dirty_ratio * PAGE_SIZE) / 100;   // 1228
        unsigned long bg_ratio = (dirty_background_ratio * PAGE_SIZE)
/ 100;  // 409
        available_memory = dtc->avail;
        thresh = (ratio * available_memory) / PAGE_SIZE;
        bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE;


So if available_memory is less than 4 pages, thresh and bg_thresh will
be both 0,
then the message will be printed.

Thanks
Yafang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-26  8:27 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28  9:54 [PATCH] mm: print a warning once the vm dirtiness settings is illogical Yafang Shao
2017-11-25 16:05 ` Tetsuo Handa
2017-11-26  2:24   ` Yafang Shao
2017-11-26  2:42     ` Tetsuo Handa
2017-11-26  4:32       ` Yafang Shao
2017-11-26  8:03         ` Tetsuo Handa
2017-11-26  8:27           ` Yafang Shao [this message]
2017-11-26  8:46           ` Yafang Shao
2017-11-26 10:38             ` Tetsuo Handa
2017-11-27  8:06               ` Yafang Shao
2017-11-27  8:21                 ` Michal Hocko
2017-11-27  8:29                   ` Yafang Shao
2017-11-27  8:32                     ` Yafang Shao
2017-11-27  8:37                       ` Michal Hocko
2017-11-27  8:49                         ` Yafang Shao
2017-11-27  8:52                           ` Michal Hocko
2017-11-27  8:54                             ` Yafang Shao
2017-11-27  9:04                               ` Michal Hocko
2017-11-27  9:08                                 ` Yafang Shao
2017-11-27  8:34                     ` Michal Hocko
2017-11-27  9:19   ` [PATCH] Revert "mm/page-writeback.c: print a warning if the vm dirtiness settings are illogical" (was: Re: [PATCH] mm: print a warning once the vm dirtiness settings is illogical) Michal Hocko
2017-11-28  3:11     ` Yafang Shao
2017-11-28  6:12       ` Yafang Shao
2017-11-28  7:45         ` Michal Hocko
2017-11-28  7:52           ` Yafang Shao
2017-11-28  9:43             ` Yafang Shao
2017-11-28  9:45             ` Michal Hocko
2017-11-28 10:09             ` Jan Kara
2017-11-28 10:16               ` Yafang Shao
2017-11-28 10:25       ` Jan Kara
2017-11-28 10:33         ` Yafang Shao
2017-11-28 10:41           ` Jan Kara
2017-11-28 10:44             ` Yafang Shao
2017-11-28 10:37     ` Jan Kara
2017-11-28 10:48       ` Michal Hocko
2017-11-28 11:05         ` Yafang Shao
2017-11-28 11:54           ` 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='CALOAHbAXLT0iztU+1gsVwEm715RWYNnDXu=JJK6jjwSEt6KmNw@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.