lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v10 09/33] mm: Add folio flag manipulation functions
    From
    Date
    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@infradead.org>
    > Reviewed-by: Christoph Hellwig <hch@lst.de>
    > Acked-by: Jeff Layton <jlayton@kernel.org>

    Acked-by: Vlastimil Babka <vbabka@suse.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)

    \
     
     \ /
      Last update: 2021-05-14 17:30    [W:3.406 / U:0.224 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site