From: Sultan Alsawaf <sultan@kerneltoast.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages
Date: Wed, 19 Feb 2020 11:40:06 -0800 [thread overview]
Message-ID: <20200219194006.GA3075@sultan-book.localdomain> (raw)
In-Reply-To: <dcd1cb4c-89dc-856b-ea1b-8d4930fec3eb@intel.com>
On Wed, Feb 19, 2020 at 11:13:21AM -0800, Dave Hansen wrote:
> On 2/19/20 10:25 AM, Sultan Alsawaf wrote:
> > Keeping kswapd running when all the failed allocations that invoked it
> > are satisfied incurs a high overhead due to unnecessary page eviction
> > and writeback, as well as spurious VM pressure events to various
> > registered shrinkers. When kswapd doesn't need to work to make an
> > allocation succeed anymore, stop it prematurely to save resources.
>
> But kswapd isn't just to provide memory to waiters. It also serves to
> get free memory back up to the high watermark. This seems like it might
> result in more frequent allocation stalls and kswapd wakeups, which
> consumes extra resources.
>
> I guess I'd wonder what positive effects you have observed as a result
> of this patch and whether you've gone looking for any negative effects.
This patch essentially stops kswapd from going overboard when a failed
allocation fires up kswapd. Otherwise, when memory pressure is really high,
kswapd just chomps through CPU time freeing pages nonstop when it isn't needed.
On a constrained system I tested (mem=2G), this patch had the positive effect of
improving overall responsiveness at high memory pressure.
On systems with more memory I tested (>=4G), kswapd becomes more expensive to
run at its higher scan depths, so stopping kswapd prematurely when there aren't
any memory allocations waiting for it prevents it from reaching the *really*
expensive scan depths and burning through even more resources.
Combine a large amount of memory with a slow CPU and the current problematic
behavior of kswapd at high memory pressure shows. My personal test scenario for
this was an arm64 CPU with a variable amount of memory (up to 4G RAM + 2G swap).
Sultan
next prev parent reply other threads:[~2020-02-19 19:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 18:25 Sultan Alsawaf
2020-02-19 19:13 ` Dave Hansen
2020-02-19 19:40 ` Sultan Alsawaf [this message]
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
[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=20200219194006.GA3075@sultan-book.localdomain \
--to=sultan@kerneltoast.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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