mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
mm/vmstat: Add functions to account folio statistics
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/ No change to generated code. 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: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Reviewed-by: David Howells <dhowells@redhat.com> Acked-by: Mike Rapoport <rppt@linux.ibm.com>
This commit is contained in:
parent
32b8fc4865
commit
a53e17e4e9
@ -415,6 +415,78 @@ static inline void drain_zonestat(struct zone *zone,
|
||||
struct per_cpu_zonestat *pzstats) { }
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
static inline void __zone_stat_mod_folio(struct folio *folio,
|
||||
enum zone_stat_item item, long nr)
|
||||
{
|
||||
__mod_zone_page_state(folio_zone(folio), item, nr);
|
||||
}
|
||||
|
||||
static inline void __zone_stat_add_folio(struct folio *folio,
|
||||
enum zone_stat_item item)
|
||||
{
|
||||
__mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void __zone_stat_sub_folio(struct folio *folio,
|
||||
enum zone_stat_item item)
|
||||
{
|
||||
__mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void zone_stat_mod_folio(struct folio *folio,
|
||||
enum zone_stat_item item, long nr)
|
||||
{
|
||||
mod_zone_page_state(folio_zone(folio), item, nr);
|
||||
}
|
||||
|
||||
static inline void zone_stat_add_folio(struct folio *folio,
|
||||
enum zone_stat_item item)
|
||||
{
|
||||
mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void zone_stat_sub_folio(struct folio *folio,
|
||||
enum zone_stat_item item)
|
||||
{
|
||||
mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void __node_stat_mod_folio(struct folio *folio,
|
||||
enum node_stat_item item, long nr)
|
||||
{
|
||||
__mod_node_page_state(folio_pgdat(folio), item, nr);
|
||||
}
|
||||
|
||||
static inline void __node_stat_add_folio(struct folio *folio,
|
||||
enum node_stat_item item)
|
||||
{
|
||||
__mod_node_page_state(folio_pgdat(folio), item, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void __node_stat_sub_folio(struct folio *folio,
|
||||
enum node_stat_item item)
|
||||
{
|
||||
__mod_node_page_state(folio_pgdat(folio), item, -folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void node_stat_mod_folio(struct folio *folio,
|
||||
enum node_stat_item item, long nr)
|
||||
{
|
||||
mod_node_page_state(folio_pgdat(folio), item, nr);
|
||||
}
|
||||
|
||||
static inline void node_stat_add_folio(struct folio *folio,
|
||||
enum node_stat_item item)
|
||||
{
|
||||
mod_node_page_state(folio_pgdat(folio), item, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void node_stat_sub_folio(struct folio *folio,
|
||||
enum node_stat_item item)
|
||||
{
|
||||
mod_node_page_state(folio_pgdat(folio), item, -folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,
|
||||
int migratetype)
|
||||
{
|
||||
@ -543,6 +615,24 @@ static inline void __dec_lruvec_page_state(struct page *page,
|
||||
__mod_lruvec_page_state(page, idx, -1);
|
||||
}
|
||||
|
||||
static inline void __lruvec_stat_mod_folio(struct folio *folio,
|
||||
enum node_stat_item idx, int val)
|
||||
{
|
||||
__mod_lruvec_page_state(&folio->page, idx, val);
|
||||
}
|
||||
|
||||
static inline void __lruvec_stat_add_folio(struct folio *folio,
|
||||
enum node_stat_item idx)
|
||||
{
|
||||
__lruvec_stat_mod_folio(folio, idx, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void __lruvec_stat_sub_folio(struct folio *folio,
|
||||
enum node_stat_item idx)
|
||||
{
|
||||
__lruvec_stat_mod_folio(folio, idx, -folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void inc_lruvec_page_state(struct page *page,
|
||||
enum node_stat_item idx)
|
||||
{
|
||||
@ -555,4 +645,21 @@ static inline void dec_lruvec_page_state(struct page *page,
|
||||
mod_lruvec_page_state(page, idx, -1);
|
||||
}
|
||||
|
||||
static inline void lruvec_stat_mod_folio(struct folio *folio,
|
||||
enum node_stat_item idx, int val)
|
||||
{
|
||||
mod_lruvec_page_state(&folio->page, idx, val);
|
||||
}
|
||||
|
||||
static inline void lruvec_stat_add_folio(struct folio *folio,
|
||||
enum node_stat_item idx)
|
||||
{
|
||||
lruvec_stat_mod_folio(folio, idx, folio_nr_pages(folio));
|
||||
}
|
||||
|
||||
static inline void lruvec_stat_sub_folio(struct folio *folio,
|
||||
enum node_stat_item idx)
|
||||
{
|
||||
lruvec_stat_mod_folio(folio, idx, -folio_nr_pages(folio));
|
||||
}
|
||||
#endif /* _LINUX_VMSTAT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user