Re: [PATCH 07/24] mm/swap: move swap_count to header to be shared

From: Chris Li
Date: Tue Nov 21 2023 - 01:51:41 EST


Hi Kairui,

On Sun, Nov 19, 2023 at 11:48 AM Kairui Song <ryncsn@xxxxxxxxx> wrote:
>
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> No feature change, prepare for later commits.

Again, I don't see the value of having this as a stand alone patch.
If one of the later patches needs to use this function as external
rather than static, move it with the patch that uses it. From the
reviewing point of view, it is unnecessary overhead to cross reference
different patches in order to figure out why it is moved.

Chris

>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> mm/swap.h | 5 +++++
> mm/swapfile.c | 5 -----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/swap.h b/mm/swap.h
> index f82d43d7b52a..a9a654af791e 100644
> --- a/mm/swap.h
> +++ b/mm/swap.h
> @@ -61,6 +61,11 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
> {
> return page_swap_info(&folio->page)->flags;
> }
> +
> +static inline unsigned char swap_count(unsigned char ent)
> +{
> + return ent & ~SWAP_HAS_CACHE; /* may include COUNT_CONTINUED flag */
> +}
> #else /* CONFIG_SWAP */
> struct swap_iocb;
> static inline void swap_readpage(struct page *page, bool do_poll,
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 0142bfc71b81..a8ae472ed2b6 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -114,11 +114,6 @@ static struct swap_info_struct *swap_type_to_swap_info(int type)
> return READ_ONCE(swap_info[type]); /* rcu_dereference() */
> }
>
> -static inline unsigned char swap_count(unsigned char ent)
> -{
> - return ent & ~SWAP_HAS_CACHE; /* may include COUNT_CONTINUED flag */
> -}
> -
> /* Reclaim the swap entry anyway if possible */
> #define TTRS_ANYWAY 0x1
> /*
> --
> 2.42.0
>
>