Re: memcg stats flushing (WAS "Re: [PATCH] fuse: disable default bdi strictlimiting")
Joanne Koong <[email protected]>
| Newsgroups | dev.linux.lists.fuse-devel,org.kernel.vger.cgroups,org.kernel.vger.linux-fsdevel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CAJnrk1ai-TqcudPoK-qFRYAJnUjBmg1kVa6Vxg3eDm5w5ivqSA@mail.gmail.com> |
On Tue, Aug 18, 2026 at 11:40 AM Yosry Ahmed <[email protected]> wrote: > > On Wed, Aug 12, 2026 at 1:59 PM Joanne Koong <[email protected]> wrote: > > > > d) vmscan (prepare_scan_control()): for determining whether reclaim > > can deactivate, there's this logic > > > > /* > > * When refaults are being observed, it means a new > > * workingset is being established. Deactivate to get > > * rid of any stale active pages quickly. > > */ > > refaults = lruvec_page_state(target_lruvec, > > WORKINGSET_ACTIVATE_ANON); > > if (refaults != target_lruvec->refaults[WORKINGSET_ANON] || > > inactive_is_low(target_lruvec, LRU_INACTIVE_ANON)) > > sc->may_deactivate |= DEACTIVATE_ANON; > > else > > sc->may_deactivate &= ~DEACTIVATE_ANON; > > > > (and same for DEACTIVATE_FILE for file-backed folios) > > > > target_lruvec->refaults[] gets set at the end of the reclaim pass. It > > stores the same lruvec_page_state() value that prepare_scan_control() > > will read at the start of the next reclaim pass, which means if > > reclaim passes happen more frequently than the 2s flushes (eg under > > sustained/heavy memory pressure), this logic will incorrectly assume > > no refaults occurred and deactivation is disabled, which afaict means > > folios won't be moved from the active -> inactive list, and reclaim > > will start evicting pages from the inactive list that are hot (eg more > > refaults). > > > > This is from reading the code rather than a reproducer though, so I > > don't know how much this matters in practice. Unlike for the writeback > > case, I don't think flushign more frequently solves the problem. It > > would shrink the staleness window but not eliminate it. Maybe one > > solution is to keep the deactivation state for a period of time if > > refaults were observed. > > We do have an internal test that runs a VM under memory pressure and > we started observing OOM kills after the ratelimited flush was added > in vmscan, so I think it's more problematic than just reclaiming hot > memory, but I didn't look too closely. > Would you be able to share the test you're using? I've been trying to repro it locally without much luck. Thanks, Joanne