From: Michal Hocko <mhocko@kernel.org>
To: Sultan Alsawaf <sultan@kerneltoast.com>
Cc: Mel Gorman <mgorman@suse.de>, Dave Hansen <dave.hansen@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages
Date: Fri, 21 Feb 2020 09:07:37 +0100 [thread overview]
Message-ID: <20200221080737.GK20509@dhcp22.suse.cz> (raw)
In-Reply-To: <20200221042232.GA2197@sultan-book.localdomain>
On Thu 20-02-20 20:22:32, Sultan Alsawaf wrote:
> On Thu, Feb 20, 2020 at 10:19:45AM +0000, Mel Gorman wrote:
> > I'm not entirely convinced. The reason the high watermark exists is to have
> > kswapd work long enough to make progress without a process having to direct
> > reclaim. The most straight-forward example would be a streaming reader of
> > a large file. It'll keep pushing the zone towards the low watermark and
> > kswapd has to keep ahead of the reader. If we cut kswapd off too quickly,
> > the min watermark is hit and stalls occur. While kswapd could stop at the
> > min watermark, it leaves a very short window for kswapd to make enough
> > progress before the min watermark is hit.
> >
> > At minimum, any change in this area would need to include the /proc/vmstats
> > on allocstat and pg*direct* to ensure that direct reclaim stalls are
> > not worse.
> >
> > I'm not a fan of the patch in question because kswapd can be woken between
> > the low and min watermark without stalling but we really do expect kswapd
> > to make progress and continue to make progress to avoid future stalls. The
> > changelog had no information on the before/after impact of the patch and
> > this is an area where intuition can disagree with real behaviour.
> >
> > --
> > Mel Gorman
> > SUSE Labs
>
> Okay, then let's test real behavior.
>
> I fired up my i5-8265U laptop with vanilla linux-next and passed mem=2G on the
> command line. After boot up, I opened up chromium and played a video on YouTube.
> Immediately after the video started, my laptop completely froze for a few
> seconds; then, a few seconds later, my cursor began to respond again, but moving
> it around was very laggy. The audio from the video playing was choppy during
> this time. About 15-20 seconds after I had started the YouTube video, my system
> finally stopped lagging.
Could you provide regular (e.g. each second) snapshots of /proc/vmstat,
ideally started before and finished after the observed behavior?
Something like
while true
do
cp /proc/vmstat vmstat.$(date +%s)
done
If you can perf record and see where the kernel spends time during that
time period then it would be really helpful as well.
> Then I tried again with my patch applied (albeit a correct version that doesn't
> use the refcount API). Upon starting the same YouTube video in chromium, my
> laptop didn't freeze or stutter at all. The cursor was responsive and there was
> no stuttering, or choppy audio.
>
> I tested this multiple times with reproducible results each time.
Your patch might be simply papering over a real problem.
> I will attach a functional v2 of the patch that I used.
>
> Sultan
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-02-21 8:07 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 18:25 [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages Sultan Alsawaf
2020-02-19 19:13 ` Dave Hansen
2020-02-19 19:40 ` Sultan Alsawaf
2020-02-19 20:05 ` Michal Hocko
2020-02-19 20:42 ` Sultan Alsawaf
2020-02-19 21:45 ` Mel Gorman
2020-02-19 22:42 ` Sultan Alsawaf
2020-02-20 10:19 ` Mel Gorman
2020-02-21 4:22 ` Sultan Alsawaf
2020-02-21 8:07 ` Michal Hocko [this message]
[not found] ` <20200221210824.GA3605@sultan-book.localdomain>
2020-02-21 21:24 ` Dave Hansen
2020-02-25 9:09 ` Michal Hocko
2020-02-25 17:12 ` Sultan Alsawaf
2020-02-26 9:05 ` Michal Hocko
2020-02-25 22:30 ` Shakeel Butt
2020-02-26 9:08 ` Michal Hocko
2020-02-26 17:00 ` Shakeel Butt
2020-02-26 17:41 ` Michal Hocko
2020-02-26 10:51 ` Hillf Danton
2020-02-26 17:04 ` Shakeel Butt
2020-02-27 1:48 ` Hillf Danton
2020-02-21 18:04 ` Shakeel Butt
2020-02-21 20:06 ` Sultan Alsawaf
2020-02-20 8:29 ` Michal Hocko
2020-02-19 19:26 ` Andrew Morton
2020-02-19 22:45 ` Sultan Alsawaf
2020-02-19 19:35 ` Michal Hocko
2020-02-21 4:30 ` [PATCH v2] " Sultan Alsawaf
2020-02-21 18:22 ` Ira Weiny
2020-02-21 20:00 ` Sultan Alsawaf
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=20200221080737.GK20509@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=sultan@kerneltoast.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;
as well as URLs for NNTP newsgroup(s).