Re: [PATCH v2 08/26] swap: Convert add_to_swap() to take a folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 05, 2022 at 06:21:36PM -0700, Andrew Morton wrote:
> On Wed,  4 May 2022 19:28:39 +0100 "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> wrote:
> 
> > The only caller already has a folio available, so this saves a conversion.
> > Also convert the return type to boolean.
> > 
> > ...
> >
> > --- a/include/linux/swap.h
> > +++ b/include/linux/swap.h
> > @@ -449,7 +449,7 @@ static inline unsigned long total_swapcache_pages(void)
> >  }
> >  
> >  extern void show_swap_cache_info(void);
> > -extern int add_to_swap(struct page *page);
> > +bool add_to_swap(struct folio *folio);
> >  extern void *get_shadow_from_swap_cache(swp_entry_t entry);
> >  extern int add_to_swap_cache(struct page *page, swp_entry_t entry,
> >  			gfp_t gfp, void **shadowp);
> > @@ -630,9 +630,9 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
> >  	return find_get_page(mapping, index);
> >  }
> >  
> > -static inline int add_to_swap(struct page *page)
> > +static inline bool add_to_swap(struct folio *folio)
> >  {
> > -	return 0;
> > +	return false;
> >  }
> >  
> 
> Neil's "mm: create new mm/swap.h header file" moved this to mm/swap.h. 
> Simple enough.
> 
> But mm/swap.h now gets its first mention of a folio yet it includes no
> prerequisites.  I guess the includer is responsible for including the
> correct headers first, which is pretty sad,

Yeah, I always like to see files include what they need.
mm_types.h isn't a terrible file to include, and we don't need to
worry about other header files including mm/swap.h.

> My fingers are itching to add a forward declaration `struct folio;',
> but I assume that isn't needed.  We'll find out soon enough ;)

Looking at the functions being provided in mm/swap.h, it seems to me
that anyone who calls them is going to need the contents of page/folio
anyway, so they're probably already including mm_types.h somehow anyway.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux