mem: cleanup multiprocess resources

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>
This commit is contained in:
Stephen Hemminger 2021-11-13 09:22:57 -08:00 committed by Thomas Monjalon
parent e8dc971b63
commit a0cc7be20d
6 changed files with 32 additions and 0 deletions

View 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();
}

View 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_ */

View 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);
}
}

View 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);

View 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();

View 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)
{