linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hugetlb memcg accounting
@ 2023-09-28  0:57 Nhat Pham
  2023-09-28  0:57 ` [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Nhat Pham
  2023-09-28  0:57 ` [PATCH v2 2/2] selftests: add a selftest to verify hugetlb usage in memcg Nhat Pham
  0 siblings, 2 replies; 26+ messages in thread
From: Nhat Pham @ 2023-09-28  0:57 UTC (permalink / raw)
  To: akpm
  Cc: riel, hannes, mhocko, roman.gushchin, shakeelb, muchun.song, tj,
	lizefan.x, shuah, mike.kravetz, yosryahmed, linux-mm,
	kernel-team, linux-kernel, cgroups

Changelog:
v2:
	* Add a cgroup mount option to enable/disable the new hugetlb memcg
	  accounting behavior (patch 1) (suggested by Johannes Weiner).
	* Add a couple more ksft_print_msg() on error to aid debugging when
	  the selftest fails. (patch 2)

Currently, hugetlb memory usage is not acounted for in the memory
controller, which could lead to memory overprotection for cgroups with
hugetlb-backed memory. This has been observed in our production system.

This patch series rectifies this issue by charging the memcg when the
hugetlb folio is allocated, and uncharging when the folio is freed. In
addition, a new selftest is added to demonstrate and verify this new
behavior.

Nhat Pham (2):
  hugetlb: memcg: account hugetlb-backed memory in memory controller
  selftests: add a selftest to verify hugetlb usage in memcg

 Documentation/admin-guide/cgroup-v2.rst       |   9 +
 MAINTAINERS                                   |   2 +
 fs/hugetlbfs/inode.c                          |   2 +-
 include/linux/cgroup-defs.h                   |   5 +
 include/linux/hugetlb.h                       |   6 +-
 include/linux/memcontrol.h                    |   8 +
 kernel/cgroup/cgroup.c                        |  15 +-
 mm/hugetlb.c                                  |  23 +-
 mm/memcontrol.c                               |  41 +++
 tools/testing/selftests/cgroup/.gitignore     |   1 +
 tools/testing/selftests/cgroup/Makefile       |   2 +
 .../selftests/cgroup/test_hugetlb_memcg.c     | 234 ++++++++++++++++++
 12 files changed, 338 insertions(+), 10 deletions(-)
 create mode 100644 tools/testing/selftests/cgroup/test_hugetlb_memcg.c

-- 
2.34.1


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

end of thread, other threads:[~2023-10-03  9:17 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28  0:57 [PATCH v2 0/2] hugetlb memcg accounting Nhat Pham
2023-09-28  0:57 ` [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Nhat Pham
2023-09-28 22:59   ` Frank van der Linden
2023-09-29  0:33     ` Nhat Pham
2023-09-29  0:38   ` Yosry Ahmed
2023-09-29  0:58     ` Nhat Pham
2023-09-29  1:07       ` Nhat Pham
2023-09-29  1:18         ` Yosry Ahmed
2023-09-29  1:25           ` Nhat Pham
2023-09-29 15:08           ` Johannes Weiner
2023-09-29 15:11             ` Yosry Ahmed
2023-09-29 17:42               ` Johannes Weiner
2023-09-29 17:48                 ` Nhat Pham
2023-09-29 18:07                 ` Frank van der Linden
2023-10-02 12:18                 ` Michal Hocko
2023-09-29 18:17   ` [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller (fix) Nhat Pham
2023-09-29 18:19     ` Nhat Pham
2023-10-02 13:43   ` [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Michal Hocko
2023-10-02 14:50     ` Johannes Weiner
2023-10-02 15:08       ` Michal Hocko
2023-10-02 15:25         ` Johannes Weiner
2023-10-02 17:32           ` Nhat Pham
2023-10-03  9:17           ` Michal Hocko
2023-10-02 16:21     ` Johannes Weiner
2023-10-02 17:28     ` Nhat Pham
2023-09-28  0:57 ` [PATCH v2 2/2] selftests: add a selftest to verify hugetlb usage in memcg Nhat Pham

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