Diff below merge the two allocators into one and remove unused
alignment/boundary arguments.  This is a small cleanup that helps
me keep track of the remaining allocators.

ok?

Index: arch/arm/arm/pmap7.c
===================================================================
RCS file: /cvs/src/sys/arch/arm/arm/pmap7.c,v
retrieving revision 1.61
diff -u -p -r1.61 pmap7.c
--- arch/arm/arm/pmap7.c        25 Mar 2021 04:12:00 -0000      1.61
+++ arch/arm/arm/pmap7.c        24 Apr 2021 09:53:11 -0000
@@ -2435,8 +2435,9 @@ pmap_bootstrap_pv_page_alloc(struct pool
                return (rv);
        }
 
-       new_page = uvm_km_kmemalloc(kernel_map, NULL, PAGE_SIZE,
-           (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT);
+       new_page = uvm_km_kmemalloc(kernel_map, NULL, PAGE_SIZE, 0,
+           (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT, no_constraint.ucr_low,
+           no_constraint.ucr_high, 0);
 
        last_bootstrap_page = new_page;
        return ((void *)new_page);
Index: dev/pci/envy.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/envy.c,v
retrieving revision 1.81
diff -u -p -r1.81 envy.c
--- dev/pci/envy.c      5 Jan 2020 01:07:58 -0000       1.81
+++ dev/pci/envy.c      24 Apr 2021 09:53:12 -0000
@@ -1834,9 +1834,9 @@ envy_allocm(void *self, int dir, size_t 
 #define ENVY_ALIGN     4
 #define ENVY_MAXADDR   ((1 << 28) - 1)
 
-       buf->addr = (caddr_t)uvm_km_kmemalloc_pla(kernel_map,
+       buf->addr = (caddr_t)uvm_km_kmemalloc(kernel_map,
            uvm.kernel_object, buf->size, 0, UVM_KMF_NOWAIT, 0,
-           (paddr_t)ENVY_MAXADDR, 0, 0, 1);
+           (paddr_t)ENVY_MAXADDR, 1);
        if (buf->addr == NULL) {
                DPRINTF("%s: unable to alloc dma segment\n", DEVNAME(sc));
                goto err_ret;
Index: dev/pci/if_bce.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bce.c,v
retrieving revision 1.53
diff -u -p -r1.53 if_bce.c
--- dev/pci/if_bce.c    10 Jul 2020 13:22:20 -0000      1.53
+++ dev/pci/if_bce.c    24 Apr 2021 09:53:12 -0000
@@ -253,9 +253,9 @@ bce_attach(struct device *parent, struct
        bce_reset(sc);
 
        /* Create the data DMA region and maps. */
-       if ((sc->bce_data = (caddr_t)uvm_km_kmemalloc_pla(kernel_map,
+       if ((sc->bce_data = (caddr_t)uvm_km_kmemalloc(kernel_map,
            uvm.kernel_object, (BCE_NTXDESC + BCE_NRXDESC) * MCLBYTES, 0,
-           UVM_KMF_NOWAIT, 0, (paddr_t)(0x40000000 - 1), 0, 0, 1)) == NULL) {
+           UVM_KMF_NOWAIT, 0, (paddr_t)(0x40000000 - 1), 1)) == NULL) {
                printf(": unable to alloc space for ring");
                return;
        }
Index: kern/kern_malloc.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_malloc.c,v
retrieving revision 1.145
diff -u -p -r1.145 kern_malloc.c
--- kern/kern_malloc.c  21 Apr 2021 10:02:05 -0000      1.145
+++ kern/kern_malloc.c  24 Apr 2021 09:53:12 -0000
@@ -228,12 +228,12 @@ 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,
+               va = (caddr_t)uvm_km_kmemalloc(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);
+                   0);
                splx(s);
                if (va == NULL) {
                        /*
Index: uvm/uvm_extern.h
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_extern.h,v
retrieving revision 1.157
diff -u -p -r1.157 uvm_extern.h
--- uvm/uvm_extern.h    12 Mar 2021 14:15:49 -0000      1.157
+++ uvm/uvm_extern.h    24 Apr 2021 09:53:12 -0000
@@ -297,11 +297,9 @@ int                        uvm_io(vm_map_t, struct uio *, 
int
 vaddr_t                        uvm_km_alloc1(vm_map_t, vsize_t, vsize_t, 
boolean_t);
 void                   uvm_km_free(vm_map_t, vaddr_t, vsize_t);
 void                   uvm_km_free_wakeup(vm_map_t, vaddr_t, vsize_t);
-vaddr_t                        uvm_km_kmemalloc_pla(struct vm_map *,
+vaddr_t                        uvm_km_kmemalloc(struct vm_map *,
                            struct uvm_object *, vsize_t, vsize_t, int,
-                           paddr_t, paddr_t, paddr_t, paddr_t, int);
-#define uvm_km_kmemalloc(map, obj, sz, flags)                          \
-       uvm_km_kmemalloc_pla(map, obj, sz, 0, flags, 0, (paddr_t)-1, 0, 0, 0)
+                           paddr_t, paddr_t, int);
 vaddr_t                        uvm_km_valloc(vm_map_t, vsize_t);
 vaddr_t                        uvm_km_valloc_try(vm_map_t, vsize_t);
 vaddr_t                        uvm_km_valloc_wait(vm_map_t, vsize_t);
Index: uvm/uvm_glue.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_glue.c,v
retrieving revision 1.80
diff -u -p -r1.80 uvm_glue.c
--- uvm/uvm_glue.c      26 Mar 2021 13:40:05 -0000      1.80
+++ uvm/uvm_glue.c      24 Apr 2021 09:53:12 -0000
@@ -266,10 +266,10 @@ uvm_uarea_alloc(void)
 {
        vaddr_t uaddr;
 
-       uaddr = uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, USPACE,
+       uaddr = uvm_km_kmemalloc(kernel_map, uvm.kernel_object, USPACE,
            USPACE_ALIGN, UVM_KMF_ZERO,
            no_constraint.ucr_low, no_constraint.ucr_high,
-           0, 0, USPACE/PAGE_SIZE);
+           USPACE/PAGE_SIZE);
 
        return (uaddr);
 }
Index: uvm/uvm_km.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_km.c,v
retrieving revision 1.143
diff -u -p -r1.143 uvm_km.c
--- uvm/uvm_km.c        26 Mar 2021 13:40:05 -0000      1.143
+++ uvm/uvm_km.c        24 Apr 2021 09:53:12 -0000
@@ -313,14 +313,13 @@ uvm_km_pgremove_intrsafe(vaddr_t start, 
  * => we return KVA of memory allocated
  * => flags: NOWAIT, VALLOC - just allocate VA, TRYLOCK - fail if we can't
  *     lock the map
- * => low, high, alignment, boundary, nsegs are the corresponding parameters
+ * => low, high, nsegs are the corresponding parameters
  *     to uvm_pglistalloc
  * => flags: ZERO - correspond to uvm_pglistalloc flags
  */
 vaddr_t
-uvm_km_kmemalloc_pla(struct vm_map *map, struct uvm_object *obj, vsize_t size,
-    vsize_t valign, int flags, paddr_t low, paddr_t high, paddr_t alignment,
-    paddr_t boundary, int nsegs)
+uvm_km_kmemalloc(struct vm_map *map, struct uvm_object *obj, vsize_t size,
+    vsize_t valign, int flags, paddr_t low, paddr_t high, int nsegs)
 {
        vaddr_t kva, loopva;
        voff_t offset;
@@ -372,8 +371,7 @@ uvm_km_kmemalloc_pla(struct vm_map *map,
                pla_flags |= UVM_PLA_WAITOK;
        if (flags & UVM_KMF_ZERO)
                pla_flags |= UVM_PLA_ZERO;
-       if (uvm_pglistalloc(size, low, high, alignment, boundary, &pgl, nsegs,
-           pla_flags) != 0) {
+       if (uvm_pglistalloc(size, low, high, 0, 0, &pgl, nsegs, pla_flags) != 
0) {
                /* Failed. */
                uvm_unmap(map, kva, kva + size);
                return (0);

Reply via email to