Re: [PATCH] mm/vmscan: wake up flushers conditionally to avoid cgroup OOM

From: Hillf Danton
Date: Mon Sep 02 2024 - 07:05:16 EST


On Thu, 29 Aug 2024 18:25:43 +0800 Jingxiang Zeng <jingxiangzeng.cas@xxxxxxxxx> wrote:
>
> @@ -4919,6 +4920,14 @@ static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc
> if (try_to_shrink_lruvec(lruvec, sc))
> lru_gen_rotate_memcg(lruvec, MEMCG_LRU_YOUNG);
>
> + /*
> + * If too many pages failed to evict due to page being dirty,
> + * memory pressure have pushed dirty pages to oldest gen,
> + * wake up flusher.
> + */
> + if (sc->nr.unqueued_dirty >= sc->nr.taken)
> + wakeup_flusher_threads(WB_REASON_VMSCAN);
> +

Because a) the right domain to processe dirty pages is writeback and b) flusher
runs independent of page reclaimer that has nothing to do with WB_REASON_SYNC,
feel free to erase WB_REASON_VMSCAN instead of adding it once more.