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

From: Andres Freund
Date: Fri Feb 19 2016 - 17:19:57 EST


On 2016-02-17 16:17:44 -0500, Rik van Riel wrote:
> On Fri, 12 Feb 2016 20:35:53 +0100
> Andres Freund <andres@xxxxxxxxxxx> wrote:
>
> > On 2016-02-12 13:46:53 +0100, Andres Freund wrote:
> > > I'm wondering why pages that are repeatedly written to, in units above
> > > the page size, are promoted to the active list? I mean if there never
> > > are any reads or re-dirtying an already-dirty page, what's the benefit
> > > of moving that page onto the active list?
> >
> > We chatted about this on IRC and you proposed testing this by removing
> > FGP_ACCESSED in grab_cache_page_write_begin. I ran tests with that,
> > after removing the aforementioned code to issue posix_fadvise(DONTNEED)
> > in postgres.
>
> That looks promising.

Indeed.


> > Here the active/inactive lists didn't change as much as I hoped. A bit
> > of reading made it apparent that the workingset logic in
> > add_to_page_cache_lru() defated that attempt,
>
> The patch below should help with that.
>
> Does the GFP_ACCESSED change still help with the patch
> below applied?

I've not yet run any tests, but I'd earlier used perf probes to see
where pages got activated, and I saw activations from both places. So
presumably there'd be a difference; i.e. ISTM we need to change both
places.


Regards,

Andres