ANDROID: MGLRU: Avoid reactivation of anon pages on swap full
authorKalesh Singh <kaleshsingh@google.com>
Tue, 14 Feb 2023 22:17:57 +0000 (14:17 -0800)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 17 Jan 2024 17:15:54 +0000 (18:15 +0100)
This is a combination of the following two commits:

ANDROID: MGLRU: Don't skip anon reclaim if swap low

MGLRU tries to avoid doing unnecessary anon reclaim work if swap is
low by checking if the available swap is less than the MIN_BATCH_SIZE
(256kB). This can lead to unintened consequences where PSI pressure is
less and LMKD doesn't wake up in time to avoid file cache thrashing.

Remove this check to preserve the old bahavior. This can be improved
later on once we have a low swap notification event from the kernel.

Bug: 268574308
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
ANDROID: MGLRU: Avoid reactivation of anon pages on swap full

Avoid anon reclaim if swapping full since this reactivates the
pages.

Bug: 261619133
Bug: 276521916
Change-Id: I197513d50458f2b752957152ef67fe285c7bbaf4
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
[backport of the commit 0491ec319e940b68a1e94145a14e1c65915d7a45 from android13-5.15 branch]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
mm/vmscan.c

index 5f80234..a7ccb96 100644 (file)
@@ -2606,7 +2606,7 @@ static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc)
 
        /* FIXME: see a2a36488a61c + 26aa2d199d6f */
        if (/* !can_demote(pgdat->node_id, sc) && */
-           mem_cgroup_get_nr_swap_pages(memcg) < MIN_LRU_BATCH)
+           mem_cgroup_get_nr_swap_pages(memcg) <= 0)
                return 0;
 
        return mem_cgroup_swappiness(memcg);