RE: mm: pages are not freed from lru_add_pvecs after process termination

From: Odzioba, Lukasz
Date: Fri May 13 2016 - 08:05:14 EST


On Wed 05-11-16 09:53:00, Michal Hocko wrote:
> Yes I think this makes sense. The only case where it would be suboptimal
> is when the pagevec was already full and then we just created a single
> page pvec to drain it. This can be handled better though by:
>
> diff --git a/mm/swap.c b/mm/swap.c
> index 95916142fc46..3fe4f180e8bf 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -391,9 +391,8 @@ static void __lru_cache_add(struct page *page)
> struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
>
> get_page(page);
>- if (!pagevec_space(pvec))
>+ if (!pagevec_add(pvec, page) || PageCompound(page))
> __pagevec_lru_add(pvec);
>- pagevec_add(pvec, page);
> put_cpu_var(lru_add_pvec);
>}

Oh yeah, that's exactly what I meant, couldn't find such elegant way of
handling this special case and didn't want to obscure the idea.

I'll do the tests proposed by Date and be back here with results next week.

Thank you guys for the involvement,
Lukas