lkml.org 
[lkml]   [2021]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH v3 03/25] mm/vmstat: Add folio stat wrappers
    Date
    On 28 Jan 2021, at 2:03, Matthew Wilcox (Oracle) wrote:

    > Allow page counters to be more readily modified by callers which have
    > a folio. Name these wrappers with 'stat' instead of 'state' as requested
    > by Linus here:
    > https://lore.kernel.org/linux-mm/CAHk-=wj847SudR-kt+46fT3+xFFgiwpgThvm7DJWGdi4cVrbnQ@mail.gmail.com/
    >
    > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    > ---
    > include/linux/vmstat.h | 60 ++++++++++++++++++++++++++++++++++++++++++
    > 1 file changed, 60 insertions(+)
    >
    > diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
    > index 773135fc6e19..3c3373c2c3c2 100644
    > --- a/include/linux/vmstat.h
    > +++ b/include/linux/vmstat.h
    > @@ -396,6 +396,54 @@ static inline void drain_zonestat(struct zone *zone,
    > struct per_cpu_pageset *pset) { }
    > #endif /* CONFIG_SMP */
    >
    > +static inline
    > +void __inc_zone_folio_stat(struct folio *folio, enum zone_stat_item item)
    > +{
    > + __inc_zone_page_state(&folio->page, item);

    Shouldn’t we change the stats with folio_nr_pages(folio) here? And all
    changes below. Otherwise one folio is always counted as a single page.

    > +}
    > +
    > +static inline
    > +void __dec_zone_folio_stat(struct folio *folio, enum zone_stat_item item)
    > +{
    > + __dec_zone_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void inc_zone_folio_stat(struct folio *folio, enum zone_stat_item item)
    > +{
    > + inc_zone_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void dec_zone_folio_stat(struct folio *folio, enum zone_stat_item item)
    > +{
    > + dec_zone_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void __inc_node_folio_stat(struct folio *folio, enum node_stat_item item)
    > +{
    > + __inc_node_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void __dec_node_folio_stat(struct folio *folio, enum node_stat_item item)
    > +{
    > + __dec_node_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void inc_node_folio_stat(struct folio *folio, enum node_stat_item item)
    > +{
    > + inc_node_page_state(&folio->page, item);
    > +}
    > +
    > +static inline
    > +void dec_node_folio_stat(struct folio *folio, enum node_stat_item item)
    > +{
    > + dec_node_page_state(&folio->page, item);
    > +}
    > +
    > static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,
    > int migratetype)
    > {
    > @@ -530,6 +578,18 @@ static inline void __dec_lruvec_page_state(struct page *page,
    > __mod_lruvec_page_state(page, idx, -1);
    > }
    >
    > +static inline void __inc_lruvec_folio_stat(struct folio *folio,
    > + enum node_stat_item idx)
    > +{
    > + __mod_lruvec_page_state(&folio->page, idx, 1);
    > +}
    > +
    > +static inline void __dec_lruvec_folio_stat(struct folio *folio,
    > + enum node_stat_item idx)
    > +{
    > + __mod_lruvec_page_state(&folio->page, idx, -1);
    > +}
    > +
    > static inline void inc_lruvec_state(struct lruvec *lruvec,
    > enum node_stat_item idx)
    > {
    > --
    > 2.29.2



    Best Regards,
    Yan Zi
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2021-03-02 14:45    [W:2.658 / U:0.872 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site