On Thu 30-03-23 00:42:36, Yosry Ahmed wrote: > On Thu, Mar 30, 2023 at 12:39 AM Michal Hocko <mhocko@xxxxxxxx> wrote: > > > > On Tue 28-03-23 22:16:42, Yosry Ahmed wrote: > > > In workingset_refault(), we call > > > mem_cgroup_flush_stats_atomic_ratelimited() to flush stats within an > > > RCU read section and with sleeping disallowed. Move the call above > > > the RCU read section and allow sleeping to avoid unnecessarily > > > performing a lot of work without sleeping. > > > > Could you say few words why the flushing is done before counters are > > updated rather than after (the RCU section)? > > It's not about the counters that are updated, it's about the counters > that we read. Stats readers do a flush first to read accurate stats. > We flush before a read, not after an update. Right you are, my bad I have misread the intention here. Acked-by: Michal Hocko <mhocko@xxxxxxxx> -- Michal Hocko SUSE Labs