Skip to content

memcg: Add memcg extension to control HugeTLB allocation

Aneesh Kumar K.V cgroups linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 12 repliesIn review

Changes from V4 from the cover letter

* Add support for charge/uncharge during page migration
* Drop the usage of page->lru in unmap_hugepage_range.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14hugetlb: rename max_hstate to hugetlb_max_hstatemm/hugetlb.c+7 -70 replies
2/14hugetlbfs: don't use ERR_PTR with VM_FAULT* valuesmm/hugetlb.c+13 -50 replies
3/14hugetlbfs: Add an inline helper for finding hstate indexinclude/linux/hugetlb.h mm/hugetlb.c+16 -80 replies
4/14hugetlb: Use mmu_gather instead of a temporary linked list for accumulating pagesfs/hugetlbfs/inode.c include/linux/hugetlb.h mm/hugetlb.c +1 more+45 -311 reply
5/14hugetlb: Avoid taking i_mmap_mutex in unmap_single_vma for hugetlbmm/memory.c+1 -40 replies
6/14hugetlb: Simplify migrate_huge_pageinclude/linux/migrate.h mm/memory-failure.c mm/migrate.c+25 -572 replies
7/14memcg: Add HugeTLB extensioninclude/linux/hugetlb.h include/linux/memcontrol.h init/Kconfig +2 more+184 -13 replies
8/14hugetlb: add charge/uncharge calls for HugeTLB alloc/freemm/hugetlb.c mm/memcontrol.c+24 -10 replies
9/14memcg: track resource index in cftype privatemm/memcontrol.c+21 -61 reply
10/14hugetlbfs: Add memcg control files for hugetlbfsinclude/linux/hugetlb.h include/linux/memcontrol.h mm/hugetlb.c +1 more+64 -12 replies
11/14hugetlbfs: Add a list for tracking in-use HugeTLB pagesinclude/linux/hugetlb.h mm/hugetlb.c+8 -50 replies
12/14memcg: move HugeTLB resource count to parent cgroup on memcg removalinclude/linux/hugetlb.h include/linux/memcontrol.h mm/hugetlb.c +1 more+123 -103 replies
13/14hugetlb: migrate memcg info from oldpage to new page during migrationinclude/linux/memcontrol.h mm/memcontrol.c mm/migrate.c+40 -00 replies
14/14memcg: Add memory controller documentation for hugetlb managementDocumentation/cgroups/memory.txt+29 -00 replies

Reviews trailers per patch

9 of 14 patches have a Reviewed-by or Acked-by.

PatchMichal HockoKAMEZAWA HiroyukiHillf Danton
1/14A-b R-b A-b
2/14R-b
3/14A-b R-b
4/14R-b
5/14
6/14
7/14A-b
8/14R-b A-b
9/14A-b
10/14A-b
11/14R-b
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH -V5 00/14] memcg: Add memcg extension to control HugeTLB allocation

Hi,

This patchset implements a memory controller extension to control HugeTLB allocations. The extension allows to limit the HugeTLB usage per control group and enforces the controller limit during page fault. Since HugeTLB doesn't support page reclaim, enforcing the limit at page fault time implies that, the application will get SIGBUS signal if it tries to access HugeTLB pages beyond its limit. This requires the application to know beforehand how much HugeTLB pages it would require for its use.

The goal is to control how many HugeTLB pages a group of task can allocate. It can be looked at as an extension of the existing quota interface which limits the number of HugeTLB pages per hugetlbfs superblock. HPC job scheduler requires jobs to specify their resource requirements in the job file. Once their requirements can be met, job schedulers like (SLURM) will schedule the job. We need to make sure that the jobs won't consume more resources than requested. If they do we should either error out or kill the application.

Patches are on top of
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-3.5

Changes from V4:
* Add support for charge/uncharge during page migration
* Drop the usage of page->lru in unmap_hugepage_range.

Changes from v3:
* Address review feedback.
* Fix a bug in cgroup removal related parent charging with use_hierarchy set

Changes from V2:
* Changed the implementation to limit the HugeTLB usage during page fault time. This simplifies the extension and keep it closer to memcg design. This also allows to support cgroup removal with less complexity. Only caveat is the application should ensure its HugeTLB usage doesn't cross the cgroup limit.

Changes from V1:
* Changed the implementation as a memcg extension. We still use the same logic to track the cgroup and range.

Changes from RFC post:
* Added support for HugeTLB cgroup hierarchy
* Added support for task migration
* Added documentation patch
* Other bug fixes

-aneesh