diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index a0e507337acc..67c055298914 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -357,6 +357,11 @@ enum page_memcg_data_flags { static inline bool folio_memcg_kmem(struct folio *folio); +int mem_cgroup_move_account(struct page *page, + bool compound, + struct mem_cgroup *from, + struct mem_cgroup *to); + /* * After the initialization objcg->memcg is always pointing at * a valid memcg, but can be atomically swapped to the parent memcg. @@ -1188,6 +1193,14 @@ static inline bool PageMemcgKmem(struct page *page) return false; } +static inline int mem_cgroup_move_account(struct page *page, + bool compound, + struct mem_cgroup *from, + struct mem_cgroup *to) +{ + return 0; +} + static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) { return true; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ee5e370de64f..f07b1e135fd2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5750,7 +5750,7 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma, * This function doesn't do "charge" to new cgroup and doesn't do "uncharge" * from old cgroup. */ -static int mem_cgroup_move_account(struct page *page, +int mem_cgroup_move_account(struct page *page, bool compound, struct mem_cgroup *from, struct mem_cgroup *to) @@ -5861,6 +5861,7 @@ out_unlock: out: return ret; } +EXPORT_SYMBOL_GPL(mem_cgroup_move_account); /** * get_mctgt_type - get target type of moving charge