[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4y-3h7MrWj__CuYa83XxDwj7xP0JzQJtkTCxwNCPUMB5w@mail.gmail.com>
Date: Thu, 11 Apr 2024 13:27:24 +1200
From: Barry Song <21cnbao@...il.com>
To: SeongJae Park <sj@...nel.org>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
baolin.wang@...ux.alibaba.com, chrisl@...nel.org, david@...hat.com,
hanchuanhua@...o.com, hannes@...xchg.org, hughd@...gle.com,
kasong@...cent.com, ryan.roberts@....com, surenb@...gle.com,
v-songbaohua@...o.com, willy@...radead.org, xiang@...nel.org,
ying.huang@...el.com, yosryahmed@...gle.com, yuzhao@...gle.com,
ziy@...dia.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/5] mm: swap: introduce swap_free_nr() for batched swap_free()
On Thu, Apr 11, 2024 at 11:38 AM SeongJae Park <sj@...nel.org> wrote:
>
> Hi Barry,
>
> On Tue, 9 Apr 2024 20:26:27 +1200 Barry Song <21cnbao@...il.com> wrote:
>
> > From: Chuanhua Han <hanchuanhua@...o.com>
> >
> > While swapping in a large folio, we need to free swaps related to the whole
> > folio. To avoid frequently acquiring and releasing swap locks, it is better
> > to introduce an API for batched free.
> >
> > Signed-off-by: Chuanhua Han <hanchuanhua@...o.com>
> > Co-developed-by: Barry Song <v-songbaohua@...o.com>
> > Signed-off-by: Barry Song <v-songbaohua@...o.com>
> > ---
> > include/linux/swap.h | 5 +++++
> > mm/swapfile.c | 51 ++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 56 insertions(+)
> >
> > diff --git a/include/linux/swap.h b/include/linux/swap.h
> > index 11c53692f65f..b7a107e983b8 100644
> > --- a/include/linux/swap.h
> > +++ b/include/linux/swap.h
> [...]
> > +void swap_free_nr(swp_entry_t entry, int nr_pages)
> > +{
> > +}
>
> I found the latest mm-unstable fails build when CONFIG_SWAP is not set with
> errors including below, and 'git bisect' points this patch.
>
> do_mounts.c:(.text+0x6): multiple definition of `swap_free_nr'; init/main.o:main.c:(.text+0x9c): first defined here
>
> I think this should be defined as 'static inline'? I confirmed adding the two
> keywords as below fixes the build failure.
definitely yes.
It's highly likely that it was an oversight. we definitely meant
static inline for !CONFIG_SWAP.
Thanks! will fix it in v3.
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 4bf5090de0fd..5fd60d733ba8 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -562,7 +562,7 @@ static inline void swap_free(swp_entry_t swp)
> {
> }
>
> -void swap_free_nr(swp_entry_t entry, int nr_pages)
> +static inline void swap_free_nr(swp_entry_t entry, int nr_pages)
> {
> }
>
>
> Thanks,
> SJ
>
Thanks
Barry
Powered by blists - more mailing lists