On 13/04/21(Tue) 02:05, Alexander Bluhm wrote:
> On Mon, Mar 22, 2021 at 11:50:00AM +0100, Mark Kettenis wrote:
> > > Date: Mon, 22 Mar 2021 11:29:52 +0100
> > > From: Martin Pieuchot <[email protected]>
> > >
> > > Convert the last MI uvm_km_zalloc(9) to km_alloc(9), ok?
> >
> > Also needs some careful testing on multiple architectures.
>
> I did run both diffs through a full regress on armv7, arm64, amd64,
> i386 a while ago. No fallout.
I've been running those on sparc64. So I'd be interested for tests on
powerpc{,64} and octeon. This is obviously for after release :o)
Index: kern/kern_malloc.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_malloc.c,v
retrieving revision 1.144
diff -u -p -r1.144 kern_malloc.c
--- kern/kern_malloc.c 23 Feb 2021 13:50:16 -0000 1.144
+++ kern/kern_malloc.c 13 Apr 2021 10:25:03 -0000
@@ -580,8 +580,8 @@ kmeminit(void)
FALSE, &kmem_map_store);
kmembase = (char *)base;
kmemlimit = (char *)limit;
- kmemusage = (struct kmemusage *) uvm_km_zalloc(kernel_map,
- (vsize_t)(nkmempages * sizeof(struct kmemusage)));
+ kmemusage = km_alloc(round_page(nkmempages * sizeof(struct kmemusage)),
+ &kv_any, &kp_zero, &kd_waitok);
for (indx = 0; indx < MINBUCKET + 16; indx++) {
XSIMPLEQ_INIT(&bucket[indx].kb_freelist);
}
Index: uvm/uvm_page.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_page.c,v
retrieving revision 1.156
diff -u -p -r1.156 uvm_page.c
--- uvm/uvm_page.c 26 Mar 2021 13:40:05 -0000 1.156
+++ uvm/uvm_page.c 13 Apr 2021 10:25:02 -0000
@@ -542,8 +542,8 @@ uvm_page_physload(paddr_t start, paddr_t
npages = end - start; /* # of pages */
- pgs = (struct vm_page *)uvm_km_zalloc(kernel_map,
- npages * sizeof(*pgs));
+ pgs = km_alloc(npages * sizeof(*pgs), &kv_any, &kp_zero,
+ &kd_waitok);
if (pgs == NULL) {
printf("uvm_page_physload: can not malloc vm_page "
"structs for segment\n");