Re: Unhelpful caching decisions, possibly related to active/inactive sizing

From: Johannes Weiner
Date: Fri Feb 12 2016 - 15:24:30 EST


On Thu, Feb 11, 2016 at 03:34:04PM -0500, Rik van Riel wrote:
> On Tue, 9 Feb 2016 17:42:56 -0500
> Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> > On Tue, Feb 09, 2016 at 05:52:40PM +0100, Andres Freund wrote:
>
> > > Rik asked me about active/inactive sizing in /proc/meminfo:
> > > Active: 7860556 kB
> > > Inactive: 5395644 kB
> > > Active(anon): 2874936 kB
> > > Inactive(anon): 432308 kB
> > > Active(file): 4985620 kB
> > > Inactive(file): 4963336 kB
>
> > Yes, a generous minimum size of the inactive list made sense when it
> > was the exclusive staging area to tell use-once pages from use-many
> > pages. Now that we have refault information to detect use-many with
> > arbitrary inactive list size, this minimum is no longer reasonable.
> >
> > The new minimum should be smaller, but big enough for applications to
> > actually use the data in their pages between fault and eviction
> > (i.e. it needs to take the aggregate readahead window into account),
> > and big enough for active pages that are speculatively challenged
> > during workingset changes to get re-activated without incurring IO.
> >
> > However, I don't think it makes sense to dynamically adjust the
> > balance between the active and the inactive cache during refaults.
>
> Johannes, does this patch look ok to you?

Yes, the anon ratio we use looks like a good fit for file as well.

I've updated the patch to work with cgroups.