ANDROID: mm: introduce export symbol compact_node_async

This is an exported function to compact all zones within a node
with MIGRATE_ASYNC mode.

Bug: 351175506
Change-Id: Id98f6b87b586043e2f94f08e1201829274a6bf34
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2024-07-15 19:33:17 +09:00
committed by Suren Baghdasaryan
parent 3840257b59
commit da27500dcc
2 changed files with 31 additions and 0 deletions
+1
View File
@@ -101,6 +101,7 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order,
extern void __meminit kcompactd_run(int nid);
extern void __meminit kcompactd_stop(int nid);
extern void wakeup_kcompactd(pg_data_t *pgdat, int order, int highest_zoneidx);
extern void compact_node_async(int nid);
#else
static inline void reset_isolation_suitable(pg_data_t *pgdat)
+30
View File
@@ -2895,6 +2895,36 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
return rc;
}
/* Compact all zones within a node with MIGRATE_ASYNC */
void compact_node_async(int nid)
{
pg_data_t *pgdat = NODE_DATA(nid);
int zoneid;
struct zone *zone;
struct compact_control cc = {
.order = -1,
.mode = MIGRATE_ASYNC,
.ignore_skip_hint = true,
.whole_zone = true,
.gfp_mask = GFP_KERNEL,
.proactive_compaction = false,
};
for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
zone = &pgdat->node_zones[zoneid];
if (!populated_zone(zone))
continue;
if (fatal_signal_pending(current))
break;
cc.zone = zone;
compact_zone(&cc, NULL);
}
}
EXPORT_SYMBOL_GPL(compact_node_async);
/*
* compact_node() - compact all zones within a node
* @pgdat: The node page data