lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b577925b-cda8-c902-aa17-3588e8ab5d5a@suse.cz>
Date:   Fri, 14 May 2021 17:29:56 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        akpm@...ux-foundation.org
Cc:     linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Christoph Hellwig <hch@....de>,
        Jeff Layton <jlayton@...nel.org>
Subject: Re: [PATCH v10 09/33] mm: Add folio flag manipulation functions

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@...radead.org>
> Reviewed-by: Christoph Hellwig <hch@....de>
> Acked-by: Jeff Layton <jlayton@...nel.org>

Acked-by: Vlastimil Babka <vbabka@...e.cz>

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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ