On 7/15/21 5:35 AM, Matthew Wilcox (Oracle) wrote: > Convert all callers of mem_cgroup_charge() to call page_folio() on the > page they're currently passing in. Many of them will be converted to > use folios themselves soon. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index c2ffad021e09..03283d97b62a 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -6681,10 +6681,9 @@ void mem_cgroup_calculate_protection(struct mem_cgroup *root, > atomic_long_read(&parent->memory.children_low_usage))); > } > > -static int __mem_cgroup_charge(struct page *page, struct mem_cgroup *memcg, > +static int __mem_cgroup_charge(struct folio *folio, struct mem_cgroup *memcg, > gfp_t gfp) The git/next version also renames this function to charge_memcg(), why? The new name doesn't look that internal as the old one. I don't have a strong opinion but CCing memcg maintainers who might. > { > - struct folio *folio = page_folio(page); > unsigned int nr_pages = folio_nr_pages(folio); > int ret; > > @@ -6697,27 +6696,27 @@ static int __mem_cgroup_charge(struct page *page, struct mem_cgroup *memcg, > > local_irq_disable(); > mem_cgroup_charge_statistics(memcg, nr_pages); > - memcg_check_events(memcg, page_to_nid(page)); > + memcg_check_events(memcg, folio_nid(folio)); > local_irq_enable(); > out: > return ret; > } >