Commit c833f6aa authored by Jim Harris's avatar Jim Harris
Browse files

env_dpdk: unlink hugepages if shm_id is not specified



The only release to not unlink hugepages after mmaping
them is for multiprocess.  But if shm_id is not
specified, then we aren't using multiprocess.  This
ensures that all hugepages get released when the
process exits, even if there is memory in those
hugepages that was not freed during process shutdown.

Make sure we don't enable both huge-unlink and
single-file-segments at the same time though, DPDK doesn't
support that.

Note that even when using multi-process, if hugepages
aren't released, they aren't really leaked.  DPDK will
clean them up next time the application runs.

Fixes issue #2267.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I017bd4f7ed9cf6aaa141879539b099fb48f357f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10991


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 5d68b118
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -342,7 +342,13 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
	}

	/* unlink hugepages after initialization */
	if (opts->unlink_hugepage) {
	/* Note: Automatically unlink hugepage when shm_id < 0, since it means we're not using
	 * multi-process so we don't need the hugepage links anymore.  But we need to make sure
	 * we don't specify --huge-unlink implicitly if --single-file-segments was specified since
	 * DPDK doesn't support that.
	 */
	if (opts->unlink_hugepage ||
	    (opts->shm_id < 0 && !opts->hugepage_single_segments)) {
		args = push_arg(args, &argcount, _sprintf_alloc("--huge-unlink"));
		if (args == NULL) {
			return -1;