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: 423742169

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

View File

@@ -376,6 +376,11 @@ void do_traversal_all_lruvec(int (*callback)(struct mem_cgroup *memcg,
void *private),
void *private);
int mem_cgroup_move_account(struct folio *folio,
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.
@@ -1146,6 +1151,14 @@ static inline bool PageMemcgKmem(struct page *page)
return false;
}
static inline int mem_cgroup_move_account(struct folio *folio,
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

@@ -757,7 +757,7 @@ static void memcg1_charge_statistics(struct mem_cgroup *memcg, int nr_pages);
* This function doesn't do "charge" to new cgroup and doesn't do "uncharge"
* from old cgroup.
*/
static int mem_cgroup_move_account(struct folio *folio,
int mem_cgroup_move_account(struct folio *folio,
bool compound,
struct mem_cgroup *from,
struct mem_cgroup *to)
@@ -866,6 +866,7 @@ static int mem_cgroup_move_account(struct folio *folio,
out:
return ret;
}
EXPORT_SYMBOL_GPL(mem_cgroup_move_account);
/**
* get_mctgt_type - get target type of moving charge