From: Theo Buehler Subject: Re: Towards killing uvm_km_kmemalloc_pla() To: tech@openbsd.org Date: Mon, 10 Nov 2025 08:13:08 +0100 On Sun, Nov 09, 2025 at 10:44:51PM +0000, Martin Pieuchot wrote: > 14 years later, the conversion to km_alloc(9) is almost finished. Diff > below removes all dead code from uvm_km_kmemalloc_pla() to ease reviews > and make it simpler to discuss the final conversion. It includes: > > - No behavior change > - Remove unused arguments > - Use `kmem_map' directly > - Kill UVM_KMF_* flags and use UVM_FLAG_TRYLOCK where necessary > > Once applied we can easily see the remaining differences with > km_alloc(9) internal which will help finding a consensus for the next > step. ok tb One tiny comment below. > Index: kern/kern_malloc.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_malloc.c,v > diff -u -p -r1.155 kern_malloc.c > --- kern/kern_malloc.c 12 Jun 2025 20:37:58 -0000 1.155 > +++ kern/kern_malloc.c 9 Nov 2025 22:27:57 -0000 > @@ -217,12 +217,9 @@ malloc(size_t size, int type, int flags) > mtx_leave(&malloc_mtx); > npg = atop(round_page(allocsize)); > s = splvm(); > - va = (caddr_t)uvm_km_kmemalloc_pla(kmem_map, NULL, > - (vsize_t)ptoa(npg), 0, > - ((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) | > - ((flags & M_CANFAIL) ? UVM_KMF_CANFAIL : 0), > - no_constraint.ucr_low, no_constraint.ucr_high, > - 0, 0, 0); > + va = (caddr_t)uvm_km_kmemalloc_pla((vsize_t)ptoa(npg), > + (flags & (M_NOWAIT|M_CANFAIL)), Not fussed, but I don't think the outer parentheses here help. > + no_constraint.ucr_low, no_constraint.ucr_high); > splx(s); > if (va == NULL) { > /*