mm:vmscan:Update the page scan prioritiy

Update the page scan priority
For qcom 4.19 kernel baseline
Moto-CRs-Fixed:(CR)

Change-Id: Ic6026b9512c971d6cb8832a2a78fef7586a12453
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/2323141
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Yu Zhao authored and Gilberto Gambugge committed 2023-06-01 00:51:08 -03:00
1 parent 30b094f614
commit edb74fec61
1 file changed
+14 -11
+14 -11
View File
@@ -4434,8 +4434,9 @@ static int evict_pages(struct lruvec *lruvec, struct scan_control *sc, int swapp
}
static long get_nr_to_scan(struct lruvec *lruvec, struct scan_control *sc, bool can_swap,
bool *need_aging)
unsigned long reclaimed, bool *need_aging)
{
int priority;
long nr_to_scan;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
@@ -4445,26 +4446,29 @@ static long get_nr_to_scan(struct lruvec *lruvec, struct scan_control *sc, bool
if (!nr_to_scan)
return 0;
/* reset the priority if the target has been met */
nr_to_scan >>= sc->nr_reclaimed < sc->nr_to_reclaim ? sc->priority : DEF_PRIORITY;
if (!mem_cgroup_online(memcg))
nr_to_scan++;
priority = 0;
else if (sc->nr_reclaimed - reclaimed >= sc->nr_to_reclaim)
priority = DEF_PRIORITY;
else
priority = sc->priority;
nr_to_scan >>= priority;
if (!nr_to_scan)
return 0;
if (!*need_aging)
return nr_to_scan;
/* skip the aging path at the default priority */
if (priority == DEF_PRIORITY)
return nr_to_scan;
/* leave the work to lru_gen_age_node() */
if (current_is_kswapd())
return 0;
/* try other memcgs before going to the aging path */
if (sc->priority == DEF_PRIORITY)
return 0;
if (try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false))
return nr_to_scan;
@@ -4477,10 +4481,9 @@ static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc
long scanned = 0;
bool need_aging = false;
bool swapped = false;
unsigned long reclaimed = sc->nr_reclaimed;
struct pglist_data *pgdat = lruvec_pgdat(lruvec);
lru_add_drain();
blk_start_plug(&plug);
if (current_is_kswapd())
@@ -4498,7 +4501,7 @@ static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc
else
swappiness = 0;
nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness, &need_aging);
nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness, reclaimed, &need_aging);
if (!nr_to_scan)
goto done;