Fix and improve the page allocator
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest11 patches 8 repliesIn review
- v112 patches 22 repliesSuperseded
Changes in v2 from the cover letter
* have DONTZERO flag instead of a ZERO flag, this way there is no need for a default.
* drop the last patch, since there is no need for a default now.
* fixed a pre-existing bug that caused wrong allocations
* renamed alloc_pages_special to reserve_pages, to make it clear it is not a normal allocation. The function now returns 0 on success and -1 on failure.
* added a NULL check in vm_free; freeing a NULL pointer is now a no-op.
* fix and improve some comments
* remove a spurious return
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/11 | lib/x86: fix page.h to include the generic headerlib/ | +1 | 1 reply | |
| 2/11 | lib/list.h: add list_add_taillib/ | +9 | 1 reply | |
| 3/11 | lib/vmalloc: add some asserts and improvementslib/ | +13 | 1 reply | |
| 4/11 | lib/asm: Fix definitions of memory areaslib/ lib/ lib/ +6 more | +42 | 5 replies | |
| 5/11 | lib/alloc_page: fix and improve the page allocatorlib/ lib/ | +118 | 0 replies | |
| 6/11 | lib/alloc.h: remove align_min from struct alloc_opslib/ lib/ lib/ +1 more | +5 | 0 replies | |
| 7/11 | lib/alloc_page: Optimization to skip known empty freelistslib/ | +11 | 0 replies | |
| 8/11 | lib/alloc_page: rework metadata formatlib/ | +30 | 0 replies | |
| 9/11 | lib/alloc: replace areas with more generic flagslib/ lib/ lib/ | +31 | 0 replies | |
| 10/11 | lib/alloc_page: Wire up FLAG_DONTZEROlib/ | +2 | 0 replies | |
| 11/11 | lib/alloc_page: Properly handle requests for fresh blockslib/ | +40 | 0 replies |
Reviews trailers per patch
9 of 11 patches have a Reviewed-by or Acked-by.
| Patch | Krish Sadhukhan | Janosch Frank |
|---|---|---|
| 1/11 | R-b | R-b |
| 2/11 | R-b | R-b |
| 3/11 | A-b | |
| 4/11 | R-b | |
| 5/11 | ||
| 6/11 | R-b | |
| 7/11 | R-b | |
| 8/11 | R-b | |
| 9/11 | R-b | |
| 10/11 | ||
| 11/11 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [kvm-unit-tests PATCH v2 00/11] Fix and improve the page allocator
My previous patchseries was rushed and not polished enough. Furthermore it introduced some regressions.
This patchseries fixes hopefully all the issues reported, and introduces some new features.
It also simplifies the code and hopefully makes it more readable.
Fixed:
* allocated memory is now zeroed by default
New features:
* per-allocation flags to specify not just the area (like before) but also other parameters
- dontzero flag: the allocation will not be zeroed
- fresh flag: the returned memory has never been read or written to before
I would appreciate if people could test these patches, especially on strange, unusual or exotic hardware (I tested only on s390x)
GitLab:
https://gitlab.com/imbrenda/kvm-unit-tests/-/tree/page_allocator_fixes
CI:
https://gitlab.com/imbrenda/kvm-unit-tests/-/pipelines/241819726
v1->v2
* have DONTZERO flag instead of a ZERO flag, this way there is no need for a default.
* drop the last patch, since there is no need for a default now.
* fixed a pre-existing bug that caused wrong allocations
* renamed alloc_pages_special to reserve_pages, to make it clear it is not a normal allocation. The function now returns 0 on success and -1 on failure.
* added a NULL check in vm_free; freeing a NULL pointer is now a no-op.
* fix and improve some comments
* remove a spurious return
Claudio Imbrenda (11):
lib/x86: fix page.h to include the generic header lib/list.h: add list_add_tail
lib/vmalloc: add some asserts and improvements lib/asm: Fix definitions of memory areas lib/alloc_page: fix and improve the page allocator lib/alloc.h: remove align_min from struct alloc_ops lib/alloc_page: Optimization to skip known empty freelists lib/alloc_page: rework metadata format lib/alloc: replace areas with more generic flags lib/alloc_page: Wire up FLAG_DONTZERO lib/alloc_page: Properly handle requests for fresh blocks
lib/asm-generic/memory_areas.h | 9 +- lib/arm/asm/memory_areas.h | 11 +- lib/arm64/asm/memory_areas.h | 11 +- lib/powerpc/asm/memory_areas.h | 11 +- lib/ppc64/asm/memory_areas.h | 11 +- lib/s390x/asm/memory_areas.h | 13 +- lib/x86/asm/memory_areas.h | 27 ++-- lib/x86/asm/page.h | 4 +- lib/alloc.h | 1 - lib/alloc_page.h | 76 ++++++--- lib/list.h | 9 ++ lib/alloc_page.c | 283 +++++++++++++++++++-------------- lib/alloc_phys.c | 9 +- lib/s390x/smp.c | 2 +- lib/vmalloc.c | 23 +-- 15 files changed, 284 insertions(+), 216 deletions(-)
Signature · 1 line
2.26.2