memcg: reduce cacheline contention from lruvec stat
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 6 repliesIn review
- v22 patches 2 repliesSuperseded
- v11 patch 4 repliesSuperseded
Changes in v3 from the cover letter
- Add in a comment about memcg_pn_cold placement after memcg_pn_read_mostly (Shakeel)
- Add Shakeel's Acked-bys
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | memcg: reduce cacheline contention between lruvec stat updates and LRU listsinclude/ | +18 | 1 reply | |
| 2/2 | memcg: don't go through the lruvec for folio and kmem lruvec stat updatesmm/ | +29 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Shakeel Butt | Michal Hocko |
|---|---|---|
| 1/2 | A-b | A-b |
| 2/2 | A-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] memcg: reduce cacheline contention from lruvec stat
Memcg lruvec stat updates read fields of struct mem_cgroup_per_node and struct lruvec that can share a 128-byte cacheline pair with lines the lru_lock holder writes constantly (the LRU list heads, lru_lock or lru_zone_size[]), depending on where struct mem_cgroup_per_node lands in its slab. On CPUs that do spatial prefetching (eg Intel CPUs), this makes the stat updates contend with the lru_lock holder.
Patch 1 rearranges struct mem_cgroup_per_node so that its read-mostly line is paired with a cold line, and patch 2 makes the folio and kmem stat updates use the memcg and node they already know instead of going through the lruvec, whose pgdat field shares a cacheline pair with lru_lock or lru_zone_size[].
Results on a 2-socket Skylake (80 CPUs), average pages per second for threads faulting in and freeing memory in a single memcg:
base patch 1 patch 1+2
shmem, 20 threads 4.74M 5.59M 5.77M shmem, 80 threads 7.94M 8.66M 8.82M anon, 20 threads 3.04M 3.08M 3.10M
Changelog
---------
v2: https://lore.kernel.org/linux-mm/[email protected]/
Changes from v2 -> v3:
- Add in a comment about memcg_pn_cold placement after memcg_pn_read_mostly (Shakeel)
- Add Shakeel's Acked-bys
v1: https://lore.kernel.org/linux-mm/[email protected]/
Changes from v1 -> v2:
- Replace the lruvec_stats_percpu pointers in struct mem_cgroup with a rearranged struct mem_cgroup_per_node layout (Shakeel)
- Move lruvec_stat_mod_folio()/mod_lruvec_kmem_state() change into its own patch (Shakeel)
Joanne Koong (2):
memcg: reduce cacheline contention between lruvec stat updates and LRU
lists
memcg: don't go through the lruvec for folio and kmem lruvec stat
updates
include/linux/memcontrol.h | 29 ++++++++++------ mm/memcontrol.c | 71 ++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 53 deletions(-)
base-commit: fcec4f4bcc1101dbd7e3aff267856b3bbfe128c6
Signature · 1 line
2.52.0