mm/memcontrol: remove __mod_lruvec_page_state()

There are no more callers of __mod_lruvec_page_state(), so convert the
implementation to __lruvec_stat_mod_folio(), removing two calls to
compound_head() (one explicit, one hidden inside page_memcg()).

Link: https://lkml.kernel.org/r/20231228085748.1083901-7-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2023-12-28 08:57:48 +00:00 committed by Andrew Morton
parent b54d60b18e
commit c701123bd6
2 changed files with 22 additions and 23 deletions

View File

@ -556,19 +556,25 @@ static inline void mod_lruvec_state(struct lruvec *lruvec,
local_irq_restore(flags);
}
void __mod_lruvec_page_state(struct page *page,
void __lruvec_stat_mod_folio(struct folio *folio,
enum node_stat_item idx, int val);
static inline void mod_lruvec_page_state(struct page *page,
static inline void lruvec_stat_mod_folio(struct folio *folio,
enum node_stat_item idx, int val)
{
unsigned long flags;
local_irq_save(flags);
__mod_lruvec_page_state(page, idx, val);
__lruvec_stat_mod_folio(folio, idx, val);
local_irq_restore(flags);
}
static inline void mod_lruvec_page_state(struct page *page,
enum node_stat_item idx, int val)
{
lruvec_stat_mod_folio(page_folio(page), idx, val);
}
#else
static inline void __mod_lruvec_state(struct lruvec *lruvec,
@ -583,10 +589,16 @@ static inline void mod_lruvec_state(struct lruvec *lruvec,
mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
}
static inline void __mod_lruvec_page_state(struct page *page,
enum node_stat_item idx, int val)
static inline void __lruvec_stat_mod_folio(struct folio *folio,
enum node_stat_item idx, int val)
{
__mod_node_page_state(page_pgdat(page), idx, val);
__mod_node_page_state(folio_pgdat(folio), idx, val);
}
static inline void lruvec_stat_mod_folio(struct folio *folio,
enum node_stat_item idx, int val)
{
mod_node_page_state(folio_pgdat(folio), idx, val);
}
static inline void mod_lruvec_page_state(struct page *page,
@ -597,12 +609,6 @@ static inline void mod_lruvec_page_state(struct page *page,
#endif /* CONFIG_MEMCG */
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)
{
@ -615,12 +621,6 @@ static inline void __lruvec_stat_sub_folio(struct folio *folio,
__lruvec_stat_mod_folio(folio, idx, -folio_nr_pages(folio));
}
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)
{

View File

@ -890,16 +890,15 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
__mod_memcg_lruvec_state(lruvec, idx, val);
}
void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx,
void __lruvec_stat_mod_folio(struct folio *folio, enum node_stat_item idx,
int val)
{
struct page *head = compound_head(page); /* rmap on tail pages */
struct mem_cgroup *memcg;
pg_data_t *pgdat = page_pgdat(page);
pg_data_t *pgdat = folio_pgdat(folio);
struct lruvec *lruvec;
rcu_read_lock();
memcg = page_memcg(head);
memcg = folio_memcg(folio);
/* Untracked pages have no memcg, no lruvec. Update only the node */
if (!memcg) {
rcu_read_unlock();
@ -911,7 +910,7 @@ void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx,
__mod_lruvec_state(lruvec, idx, val);
rcu_read_unlock();
}
EXPORT_SYMBOL(__mod_lruvec_page_state);
EXPORT_SYMBOL(__lruvec_stat_mod_folio);
void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val)
{