Message ID | 20231119194740.94101-8-ryncsn@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Swapin path refactor for optimization and bugfix | expand |
Hi Kairui, On Sun, Nov 19, 2023 at 11:48 AM Kairui Song <ryncsn@gmail.com> wrote: > > From: Kairui Song <kasong@tencent.com> > > 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@tencent.com> > --- > 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 > >
Chris Li <chrisl@kernel.org> 于2023年11月21日周二 14:52写道: > > Hi Kairui, > > On Sun, Nov 19, 2023 at 11:48 AM Kairui Song <ryncsn@gmail.com> wrote: > > > > From: Kairui Song <kasong@tencent.com> > > > > 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. Good suggestion, I do this locally for easier rebase & conflict resolving, will get rid of these little parts next time. > > Chris > > > > > Signed-off-by: Kairui Song <kasong@tencent.com> > > --- > > 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 > > > >
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 /*