mm/hugetlb Try to respect mempolicy when calculating surplus huge pages
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mm/hugetlb: Prefer mempolicy nodes for calcuating surplus hugepage reservationmm/ | +22 | 3 replies | |
| 2/2 | selftests/mm: add surplus hugetlb mempolicy reservation teststools/ tools/ tools/ | +495 | 0 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Joshua Hahn |
|---|---|
| 1/2 | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] mm/hugetlb Try to respect mempolicy when calculating surplus huge pages
Presently, when calculating how many huge pages are needed when reserving surplus huge pages, the global count of free huge pages is used. When reserving with a mempolicy, the global count of free huge pages is used even if some/all of those free huge pages are on numa nodes outside of the mempolicy.
Reserving surplus huge pages is ultimately best effort even without a mempolicy. Restrictions from cpusets and mempolicies further complicate calculating correct numbers of surplus huge pages to reserve and maintaining which nodes those reservations belong to (see the comment in hugetlb_acct_memory).
However, we can do a little better when reserving surplus huge pages with a mempolicy. This patch changes how to calculate the necessary amount of surplus huge pages to reserve by considering the max of either the amount of free huge pages on nodes in the mempolicy or the global amount of free huge pages. We may still attempt to reserve huge pages outside the mempolicy, however, we end up being more likely to reserve from nodes in the mempolicy.
- v1: Modified needed calculation to use allowed_mems_nr(h) in order to consider free hugetlb pages in our mempolicy.
- v2: Folded in Joshua Hahn's recommendation [1] to further modify needed calculation to take the max of either the available hugetlb pages in the mempolicy or the globally available hugetlb pages. Allows allocations to prioritize nodes in the mempolicy but can still fall back to offnode allocations. Also added selftests to check only for the edgecase which caused this to initially be reported and sanity checks.
- v3: Split the change and tests into separate patches and clean up code to better align with kernel style guidelines. Likewise, fold in Usama Arif's correction [2].
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
Charles Haithcock (2):
mm/hugetlb: Prefer mempolicy nodes for calcuating surplus hugepage
reservation
selftests/mm: add surplus hugetlb mempolicy reservation tests
mm/hugetlb.c | 42 +- tools/testing/selftests/mm/Makefile | 3 + .../selftests/mm/hugetlb_surplus_mempolicy.c | 491 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 1 + 4 files changed, 517 insertions(+), 20 deletions(-) create mode 100644 tools/testing/selftests/mm/hugetlb_surplus_mempolicy.c
Signature · 1 line
2.55.0