ANDROID: mm: export mem_cgroup_move_account

Export mem_cgroup_move_account to migrate folios between different
memcgs. This is to achieve more accurate memory reclamation.

Bug: 373540729
Change-Id: I77ac12fdc25bae90f37f725be1a168da52f02abd
Signed-off-by: Jianan Huang <huangjianan@xiaomi.com>
(cherry picked from commit c031476ae982c66d0f0674eb0a5c1ee03e825fd7)
This commit is contained in:
Jianan Huang
2024-10-15 15:13:31 +08:00
committed by Todd Kjos
parent ff55f3e7ea
commit c0b27cdcc7
2 changed files with 15 additions and 1 deletions

View File

@@ -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;

View File

@@ -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