lkml.org 
[lkml]   [2024]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v2 1/5] mm: swap: introduce swap_free_nr() for batched swap_free()
Date
Hi Barry,

On Tue, 9 Apr 2024 20:26:27 +1200 Barry Song <21cnbao@gmail.com> wrote:

> From: Chuanhua Han <hanchuanhua@oppo.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@oppo.com>
> Co-developed-by: Barry Song <v-songbaohua@oppo.com>
> Signed-off-by: Barry Song <v-songbaohua@oppo.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.

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

[...]

\
 
 \ /
  Last update: 2024-04-11 01:38    [W:0.274 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site