Re: [PATCH v10 09/33] mm: Add folio flag manipulation functions

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

 



On 5/11/21 11:47 PM, Matthew Wilcox (Oracle) wrote:
> These new functions are the folio analogues of the various PageFlags
> functions.  If CONFIG_DEBUG_VM_PGFLAGS is enabled, we check the folio
> is not a tail page at every invocation.  This will also catch the
> PagePoisoned case as a poisoned page has every bit set, which would
> include PageTail.
> 
> This saves 1727 bytes of text with the distro-derived config that
> I'm testing due to removing a double call to compound_head() in
> PageSwapCache().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> Acked-by: Jeff Layton <jlayton@xxxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Some nits:

...

>   * Macros to create function definitions for page flags
>   */
>  #define TESTPAGEFLAG(uname, lname, policy)				\
> +static __always_inline bool folio_##lname(struct folio *folio)		\
> +{ return test_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); }	\
>  static __always_inline int Page##uname(struct page *page)		\
>  	{ return test_bit(PG_##lname, &policy(page, 0)->flags); }

Maybe unify these idents while at it?

>  
>  #define SETPAGEFLAG(uname, lname, policy)				\
> +static __always_inline							\
> +void folio_set_##lname##_flag(struct folio *folio)			\
> +{ set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); }		\
>  static __always_inline void SetPage##uname(struct page *page)		\
>  	{ set_bit(PG_##lname, &policy(page, 1)->flags); }
>  
>  #define CLEARPAGEFLAG(uname, lname, policy)				\
> +static __always_inline							\
> +void folio_clear_##lname##_flag(struct folio *folio)			\
> +{ clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); }		\
>  static __always_inline void ClearPage##uname(struct page *page)		\
>  	{ clear_bit(PG_##lname, &policy(page, 1)->flags); }
>  
>  #define __SETPAGEFLAG(uname, lname, policy)				\
> +static __always_inline							\
> +void __folio_set_##lname##_flag(struct folio *folio)			\
> +{ __set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); }		\
>  static __always_inline void __SetPage##uname(struct page *page)		\
>  	{ __set_bit(PG_##lname, &policy(page, 1)->flags); }
>  
>  #define __CLEARPAGEFLAG(uname, lname, policy)				\
> +static __always_inline							\
> +void __folio_clear_##lname##_flag(struct folio *folio)			\
> +{ __clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); }	\
>  static __always_inline void __ClearPage##uname(struct page *page)	\
>  	{ __clear_bit(PG_##lname, &policy(page, 1)->flags); }
>  
>  #define TESTSETFLAG(uname, lname, policy)				\
> +static __always_inline							\
> +bool folio_test_set_##lname##_flag(struct folio *folio)		\

The line above seems to need extra tab before '\'
(used vimdiff on your git tree)




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux