On Thu, Apr 11, 2024 at 11:38 AM SeongJae Park <sj@xxxxxxxxxx> wrote: > > Hi Barry, > > On Tue, 9 Apr 2024 20:26:27 +1200 Barry Song <21cnbao@xxxxxxxxx> wrote: > > > From: Chuanhua Han <hanchuanhua@xxxxxxxx> > > > > 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@xxxxxxxx> > > Co-developed-by: Barry Song <v-songbaohua@xxxxxxxx> > > Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx> > > --- > > 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