Re: [PATCH] mm: Stop kswapd early when nothing's waiting for it to free pages

From: Sultan Alsawaf
Date: Wed Feb 19 2020 - 17:45:11 EST


On Wed, Feb 19, 2020 at 11:26:53AM -0800, Andrew Morton wrote:
> On Wed, 19 Feb 2020 10:25:22 -0800 Sultan Alsawaf <sultan@xxxxxxxxxxxxxxx> 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.
>
> Seems sensible.
>
> Please fully describe the userspace-visible runtime effects of this
> change?
>

FWIW, it looks like the refcount API doesn't allow refcounts to be zero, so I'd
have to update this patch to use just plain atomic_t instead. But since there
doesn't seem to be much interest in this, I'll only send an updated patch if
it's desired.

Sultan