]> git.droids-corp.org - dpdk.git/commitdiff
mem: cleanup multiprocess resources
authorStephen Hemminger <stephen@networkplumber.org>
Sat, 13 Nov 2021 17:22:57 +0000 (09:22 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 11 Feb 2022 18:49:22 +0000 (19:49 +0100)
The mp action resources in malloc should be cleaned up via
rte_eal_cleanup.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/eal/common/malloc_heap.c
lib/eal/common/malloc_heap.h
lib/eal/common/malloc_mp.c
lib/eal/common/malloc_mp.h
lib/eal/linux/eal.c
lib/eal/windows/eal_mp.c

index 24080fc47349da81e4a4f4c5f3645dadb08c686f..97191bcd9be82dc6cb2621b2764f57ebe94bda44 100644 (file)
@@ -1409,3 +1409,9 @@ rte_eal_malloc_heap_init(void)
        /* add all IOVA-contiguous areas to the heap */
        return rte_memseg_contig_walk(malloc_add_seg, NULL);
 }
+
+void
+rte_eal_malloc_heap_cleanup(void)
+{
+       unregister_mp_requests();
+}
index 3a29d024b4ca45f9fc941c59f5a2a3d72766db78..3b2fbc0aa0590c963b7de146c91c81c6da6548ed 100644 (file)
@@ -85,4 +85,7 @@ malloc_socket_to_heap_id(unsigned int socket_id);
 int
 rte_eal_malloc_heap_init(void);
 
+void
+rte_eal_malloc_heap_cleanup(void);
+
 #endif /* MALLOC_HEAP_H_ */
index 2e597a17a2f25313743987e925957d70ad8997d8..5f6f275b78596fdfa06870909763dc745f3c6d6b 100644 (file)
@@ -806,3 +806,15 @@ register_mp_requests(void)
        }
        return 0;
 }
+
+void
+unregister_mp_requests(void)
+{
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+               rte_mp_action_unregister(MP_ACTION_REQUEST);
+       } else {
+               rte_mp_action_unregister(MP_ACTION_SYNC);
+               rte_mp_action_unregister(MP_ACTION_ROLLBACK);
+               rte_mp_action_unregister(MP_ACTION_RESPONSE);
+       }
+}
index 0095062b72f2ebf77eb0b50e52ac78b99f6da491..c806f7beafe0d3c0b00b7cb05e04defdb46241d6 100644 (file)
@@ -63,6 +63,9 @@ struct malloc_mp_req {
 int
 register_mp_requests(void);
 
+void
+unregister_mp_requests(void);
+
 int
 request_to_primary(struct malloc_mp_req *req);
 
index 5583ba9f377388fc5741e46f69228ab5cf4f0b03..8acf086cd9378faadb60a833f9601a05c6459d80 100644 (file)
@@ -1285,6 +1285,7 @@ rte_eal_cleanup(void)
        /* after this point, any DPDK pointers will become dangling */
        rte_eal_memory_detach();
        eal_mp_dev_hotplug_cleanup();
+       rte_eal_malloc_heap_cleanup();
        rte_eal_alarm_cleanup();
        rte_trace_save();
        eal_trace_fini();
index f2fa9366f6687231aa2d5ea6c7d081fa85f603a4..76413f49a393dbccb35c1f04c3eebbd99f3d873a 100644 (file)
@@ -87,6 +87,13 @@ register_mp_requests(void)
        return 0;
 }
 
+void
+unregister_mp_requests(void)
+{
+       /* Non-stub function succeeds if multi-process is not supported. */
+       EAL_LOG_STUB();
+}
+
 int
 request_to_primary(struct malloc_mp_req *req)
 {