lkml.org 
[lkml]   [2021]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 01/27] mm: Introduce struct folio
    From
    Date
    On 31/03/2021 20.47, Matthew Wilcox (Oracle) wrote:

    > +static inline void folio_build_bug(void)
    > +{
    > +#define FOLIO_MATCH(pg, fl) \
    > +BUILD_BUG_ON(offsetof(struct page, pg) != offsetof(struct folio, fl));
    > +
    > + FOLIO_MATCH(flags, flags);
    > + FOLIO_MATCH(lru, lru);
    > + FOLIO_MATCH(mapping, mapping);
    > + FOLIO_MATCH(index, index);
    > + FOLIO_MATCH(private, private);
    > + FOLIO_MATCH(_mapcount, _mapcount);
    > + FOLIO_MATCH(_refcount, _refcount);
    > +#ifdef CONFIG_MEMCG
    > + FOLIO_MATCH(memcg_data, memcg_data);
    > +#endif
    > +#undef FOLIO_MATCH
    > + BUILD_BUG_ON(sizeof(struct page) != sizeof(struct folio));
    > +}
    > +

    Perhaps do this next to the definition of struct folio instead of hiding
    it in some arbitrary TU - hint, we have static_assert() that doesn't
    need to be in function context. And consider amending FOLIO_MATCH by a
    static_assert(__same_type(typeof_member(...), typeof_member(...))).

    Rasmus

    \
     
     \ /
      Last update: 2021-04-08 11:02    [W:3.566 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site