Skip to content

mm: vmalloc: introduce array allocation functions

Paolo Bonzini cgroups kvm linux-mm lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm: vmalloc: introduce array allocation functionsinclude/linux/vmalloc.h mm/util.c+55 -04 replies
2/3mm: use vmalloc_array and vcalloc for array allocationsmm/percpu-stats.c mm/swap_cgroup.c+2 -43 replies
3/3KVM: use vcalloc/__vcalloc for very large allocationsarch/powerpc/kvm/book3s_hv_uvmem.c arch/x86/kvm/mmu/page_track.c arch/x86/kvm/x86.c +1 more+9 -82 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMichal HockoDavid HildenbrandDennis Zhou
1/3A-b R-b
2/3A-b R-b A-b
3/3R-b

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 0/3] mm: vmalloc: introduce array allocation functions

The first patch in this series introduces four array allocation functions to replace vmalloc(array_size()) and vzalloc(array_size()), of which Linux has dozens of occurrences. The Functions take care of the multiplication and overflow check, result in simpler code and make it easier for developers to avoid overflow bugs.

The other two patches start to apply the functions in the mm/ and KVM areas. In the case of KVM, it is also important to switch from kvcalloc to __vcalloc; the allocation size is driven by userspace and can be larger than 4GiB, which has been forbidden by the kv*alloc functions since 5.15.

Paolo

Paolo Bonzini (3):
mm: vmalloc: introduce array allocation functions
mm: use vmalloc_array and vcalloc for array allocations
KVM: use __vcalloc for very large allocations

 arch/powerpc/kvm/book3s_hv_uvmem.c |  2 +-
 arch/x86/kvm/mmu/page_track.c      |  7 +++--
 arch/x86/kvm/x86.c                 |  4 +--
 include/linux/vmalloc.h            |  5 +++
 mm/percpu-stats.c                  |  2 +-
 mm/swap_cgroup.c                   |  4 +--
 mm/util.c                          | 50 ++++++++++++++++++++++++++++++
 virt/kvm/kvm_main.c                |  4 +--
 9 files changed, 66 insertions(+), 12 deletions(-)
Signature · 1 line
2.31.1