linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] mm: memcg: subtree stats flushing and thresholds
@ 2023-11-16  2:24 Yosry Ahmed
  2023-11-16  2:24 ` [PATCH v3 1/5] mm: memcg: change flush_next_time to flush_last_time Yosry Ahmed
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Yosry Ahmed @ 2023-11-16  2:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Shakeel Butt,
	Muchun Song, Ivan Babrou, Tejun Heo, Michal Koutný,
	Waiman Long, kernel-team, Wei Xu, Greg Thelen,
	Domenico Cerasuolo, linux-mm, cgroups, linux-kernel, Yosry Ahmed

This series attempts to address shortages in today's approach for memcg
stats flushing, namely occasionally stale or expensive stat reads. The
series does so by changing the threshold that we use to decide whether
to trigger a flush to be per memcg instead of global (patch 3), and then
changing flushing to be per memcg (i.e. subtree flushes) instead of
global (patch 5).

Patch 3 & 5 are the core of the series, and they include more details
and testing results. The rest are either cleanups or prep work.

This series replaces the "memcg: more sophisticated stats flushing"
series [1], which also replaces another series, in a long list of
attempts to improve memcg stats flushing. It is not a new version of
the same patchset as it is a completely different approach. This is
based on collected feedback from discussions on lkml in all previous
attempts. Hopefully, this is the final attempt.

There was a reported regression in v2 [2] for will-it-scale::fallocate
benchmark. I believe this regression should not affect production
workloads. This specific benchmark is allocating and freeing memory
(using fallocate/ftruncate) at a rate that is much faster to make actual
use of the memory. Testing this series on 100+ machines running
production workloads did not show any practical regressions in page
fault latency or allocation latency, but it showed great improvements in
stats read time. I do not have numbers about the exact improvements for
this series, but combined with another optimization for cgroup v1 [3] we
see 5-10x improvements. A significant chunk of that is coming from the
cgroup v1 optimization, but this series also made an improvement as
reported by Domenico [4].

[1]https://lore.kernel.org/lkml/20230913073846.1528938-1-yosryahmed@google.com/
[2]https://lore.kernel.org/lkml/202310202303.c68e7639-oliver.sang@intel.com/
[3]https://lore.kernel.org/lkml/20230803185046.1385770-1-yosryahmed@google.com/
[4]https://lore.kernel.org/lkml/CAFYChMv_kv_KXOMRkrmTN-7MrfgBHMcK3YXv0dPYEL7nK77e2A@mail.gmail.com/

v2 -> v3:
- Rebased on top of v6.7-rc1.
- Updated commit messages based on discussions in previous versions.
- Reset percpu stats_updates in mem_cgroup_css_rstat_flush().
- Added a mem_cgroup_disabled() check to mem_cgroup_flush_stats().

v2: https://lore.kernel.org/lkml/20231010032117.1577496-1-yosryahmed@google.com/

Yosry Ahmed (5):
  mm: memcg: change flush_next_time to flush_last_time
  mm: memcg: move vmstats structs definition above flushing code
  mm: memcg: make stats flushing threshold per-memcg
  mm: workingset: move the stats flush into workingset_test_recent()
  mm: memcg: restore subtree stats flushing

 include/linux/memcontrol.h |   8 +-
 mm/memcontrol.c            | 272 +++++++++++++++++++++----------------
 mm/vmscan.c                |   2 +-
 mm/workingset.c            |  42 ++++--
 4 files changed, 188 insertions(+), 136 deletions(-)

-- 
2.43.0.rc0.421.g78406f8d94-goog



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-11-28  1:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16  2:24 [PATCH v3 0/5] mm: memcg: subtree stats flushing and thresholds Yosry Ahmed
2023-11-16  2:24 ` [PATCH v3 1/5] mm: memcg: change flush_next_time to flush_last_time Yosry Ahmed
2023-11-17 18:22   ` Shakeel Butt
2023-11-17 18:27   ` Chris Li
2023-11-16  2:24 ` [PATCH v3 2/5] mm: memcg: move vmstats structs definition above flushing code Yosry Ahmed
2023-11-17 18:47   ` Shakeel Butt
2023-11-16  2:24 ` [PATCH v3 3/5] mm: memcg: make stats flushing threshold per-memcg Yosry Ahmed
2023-11-22 13:54   ` kernel test robot
2023-11-27 21:13     ` Yosry Ahmed
2023-11-28  1:45       ` Oliver Sang
2023-11-28  1:58         ` Yosry Ahmed
2023-11-16  2:24 ` [PATCH v3 4/5] mm: workingset: move the stats flush into workingset_test_recent() Yosry Ahmed
2023-11-16  2:24 ` [PATCH v3 5/5] mm: memcg: restore subtree stats flushing Yosry Ahmed
2023-11-22 13:42   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox