Re: [PATCH v4 6/8] mm/swap: implement workingset detection for anonymous LRU

From: Johannes Weiner
Date: Thu Apr 02 2020 - 11:14:19 EST


On Thu, Apr 02, 2020 at 02:50:28PM +0900, Joonsoo Kim wrote:
> 2020ë 3ì 24ì (í) ìí 3:25, Joonsoo Kim <js1304@xxxxxxxxx>ëì ìì:
> > The problem looks not that easy. Hmm...
> >
> > In current code, there is a large time gap between the shadow entries
> > are poped up and the page is charged to the memcg, especially,
> > for readahead-ed pages. We cannot maintain the shadow entries of
> > the readahead-ed pages until the pages are charged.
> >
> > My plan to solve this problem is propagating the charged mm to
> > __read_swap_cache_async(), like as file cache, charging when
> > the page is added on to the swap cache and calling workingset_refault()
> > there. Charging will only occur if:
> >
> > 1. faulted page
> > 2. readahead-ed page with the shadow entry for the same memcg
> >
> > Also, readahead only happens when shadow entry's memcg is the same
> > with the charged memcg. If not the same, it's mostly not ours so
> > readahead isn't needed.
> >
> > Please let me know how you think of the feasibility of this idea.
>
> Hello, Johannes.
>
> Could you let me know your opinion about the idea above?
> In fact, since your reply is delayed, I completed the solution about the
> above idea. If you want, I will submit it first. Then, we could discuss
> the solution more easily.

It's probably easiest if you send out your implementation and we
discuss it over the code.

Thanks!