Re: [PATCH 09/14] mm: deactivations shouldn't bias the LRU balance

From: Qian Cai
Date: Tue May 26 2020 - 20:54:31 EST


On Tue, May 26, 2020 at 11:55:49AM -0400, Johannes Weiner wrote:
> > mm/swap.c: In function 'lru_deactivate_file_fn':
> > mm/swap.c:504:11: warning: variable 'file' set but not used
> > [-Wunused-but-set-variable]
> > int lru, file;
> > ^~~~
>
> Oops, my gcc doesn't warn about that, but yes, it's clearly dead code.

You will probably need W=1 to see that.

>
> $ make mm/swap.o
> GEN Makefile
> CALL /home/hannes/src/linux/linux/scripts/checksyscalls.sh
> CALL /home/hannes/src/linux/linux/scripts/atomic/check-atomics.sh
> DESCEND objtool
> CC mm/swap.o
> $
>
> > This?
> >
> > diff --git a/mm/swap.c b/mm/swap.c
> > index fedf5847dfdb..9c38c1b545af 100644
> > --- a/mm/swap.c
> > +++ b/mm/swap.c
> > @@ -501,7 +501,7 @@ void lru_cache_add_active_or_unevictable(struct page *page,
> > static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
> > void *arg)
> > {
> > - int lru, file;
> > + int lru;
> > bool active;
> >
> > if (!PageLRU(page))
> > @@ -515,7 +515,6 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
> > return;
> >
> > active = PageActive(page);
> > - file = page_is_file_lru(page);
> > lru = page_lru_base_type(page);
> >
> > del_page_from_lru_list(page, lruvec, lru + active);
>
> Looks good, and it appears Andrew has already queued it. Would you
> mind providing the Signed-off-by: for it?

Don't worry about that. I believe Andrew will squash it when sending to
Linus.