Author: mjg
Date: Thu Nov  5 21:44:58 2020
New Revision: 367400
URL: https://svnweb.freebsd.org/changeset/base/367400

Log:
  nvme: change namei_request_zone into a malloc type
  
  Both the size (128 bytes) and ephemeral nature of allocations make it a great
  fit for malloc.
  
  A dedicated zone unnecessarily avoids sharing buckets with 128-byte objects.
  
  Reviewed by:  imp
  Differential Revision:        https://reviews.freebsd.org/D27103

Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme.c
==============================================================================
--- head/sys/dev/nvme/nvme.c    Thu Nov  5 21:37:24 2020        (r367399)
+++ head/sys/dev/nvme/nvme.c    Thu Nov  5 21:44:58 2020        (r367400)
@@ -49,7 +49,6 @@ struct nvme_consumer {
 struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS];
 #define        INVALID_CONSUMER_ID     0xFFFF
 
-uma_zone_t     nvme_request_zone;
 int32_t                nvme_retry_count;
 
 MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations");
@@ -61,9 +60,6 @@ nvme_init(void)
 {
        uint32_t        i;
 
-       nvme_request_zone = uma_zcreate("nvme_request",
-           sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0);
-
        for (i = 0; i < NVME_MAX_CONSUMERS; i++)
                nvme_consumer[i].id = INVALID_CONSUMER_ID;
 }
@@ -73,7 +69,6 @@ SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND
 static void
 nvme_uninit(void)
 {
-       uma_zdestroy(nvme_request_zone);
 }
 
 SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL);

Modified: head/sys/dev/nvme/nvme_private.h
==============================================================================
--- head/sys/dev/nvme/nvme_private.h    Thu Nov  5 21:37:24 2020        
(r367399)
+++ head/sys/dev/nvme/nvme_private.h    Thu Nov  5 21:44:58 2020        
(r367400)
@@ -113,7 +113,6 @@ MALLOC_DECLARE(M_NVME);
 #define CACHE_LINE_SIZE                (64)
 #endif
 
-extern uma_zone_t      nvme_request_zone;
 extern int32_t         nvme_retry_count;
 extern bool            nvme_verbose_cmd_dump;
 
@@ -489,7 +488,7 @@ _nvme_allocate_request(nvme_cb_fn_t cb_fn, void *cb_ar
 {
        struct nvme_request *req;
 
-       req = uma_zalloc(nvme_request_zone, M_NOWAIT | M_ZERO);
+       req = malloc(sizeof(*req), M_NVME, M_NOWAIT | M_ZERO);
        if (req != NULL) {
                req->cb_fn = cb_fn;
                req->cb_arg = cb_arg;
@@ -551,7 +550,7 @@ nvme_allocate_request_ccb(union ccb *ccb, nvme_cb_fn_t
        return (req);
 }
 
-#define nvme_free_request(req) uma_zfree(nvme_request_zone, req)
+#define nvme_free_request(req) free(req, M_NVME)
 
 void   nvme_notify_async_consumers(struct nvme_controller *ctrlr,
                                    const struct nvme_completion *async_cpl,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to