From: Mel Gorman <mgorman@suse.de>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v2] mm, fadvise: improve the expensive remote LRU cache draining after FADV_DONTNEED
Date: Mon, 28 Sep 2020 11:22:53 +0100 [thread overview]
Message-ID: <20200928102253.GA3165@suse.de> (raw)
In-Reply-To: <CALOAHbCn-=5csgzt0UcQ8fp8UYOh2w9j0s4gGrhbfFo-pKTd7Q@mail.gmail.com>
On Sun, Sep 27, 2020 at 12:22:16PM +0800, Yafang Shao wrote:
> On Fri, Sep 25, 2020 at 10:40 PM Mel Gorman <mgorman@suse.de> wrote:
> >
> > On Wed, Sep 23, 2020 at 09:33:18PM +0800, Yafang Shao wrote:
> > > Our users reported that there're some random latency spikes when their RT
> > > process is running. Finally we found that latency spike is caused by
> > > FADV_DONTNEED. Which may call lru_add_drain_all() to drain LRU cache on
> > > remote CPUs, and then waits the per-cpu work to complete. The wait time
> > > is uncertain, which may be tens millisecond.
> > > That behavior is unreasonable, because this process is bound to a
> > > specific CPU and the file is only accessed by itself, IOW, there should
> > > be no pagecache pages on a per-cpu pagevec of a remote CPU. That
> > > unreasonable behavior is partially caused by the wrong comparation of the
> > > number of invalidated pages and the number of the target. For example,
> > > if (count < (end_index - start_index + 1))
> > > The count above is how many pages were invalidated in the local CPU, and
> > > (end_index - start_index + 1) is how many pages should be invalidated.
> > > The usage of (end_index - start_index + 1) is incorrect, because they
> > > are virtual addresses, which may not mapped to pages. Besides that,
> > > there may be holes between start and end. So we'd better check whether
> > > there are still pages on per-cpu pagevec after drain the local cpu, and
> > > then decide whether or not to call lru_add_drain_all().
> > >
> > > After I applied it with a hotfix to our production environment, most of
> > > the lru_add_drain_all() can be avoided.
> > >
> > > Suggested-by: Mel Gorman <mgorman@suse.de>
> > > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > > Cc: Mel Gorman <mgorman@suse.de>
> > > Cc: Johannes Weiner <hannes@cmpxchg.org>
> >
> > I think that's ok. Does it succeed with the original test case from the
> > commit that introduced the behaviour and one modified to truncate part
> > of the mapping?
> >
>
> Yes, I verified the test case in commit 67d46b296a1b and then modified
> it with truncate.
> Both works fine.
>
In that case
Acked-by: Mel Gorman <mgorman@suse.de>
--
Mel Gorman
SUSE Labs
prev parent reply other threads:[~2020-09-28 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 13:33 [PATCH v2] mm, fadvise: improve the expensive remote LRU cache draining after FADV_DONTNEED Yafang Shao
2020-09-25 14:40 ` Mel Gorman
2020-09-27 4:22 ` Yafang Shao
2020-09-28 10:22 ` Mel Gorman [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=20200928102253.GA3165@suse.de \
--to=mgorman@suse.de \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).