From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 580EAA0C47; Thu, 19 Aug 2021 04:41:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BA474067E; Thu, 19 Aug 2021 04:41:05 +0200 (CEST) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id B500E40141 for ; Thu, 19 Aug 2021 04:41:03 +0200 (CEST) Received: by mail-pj1-f48.google.com with SMTP id fa24-20020a17090af0d8b0290178bfa69d97so3836332pjb.0 for ; Wed, 18 Aug 2021 19:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vGCaRncP4WFM39bvzIL74x0FJxRrPRbjBsSoFV07grM=; b=ZeUppvBTrUgcyq8mo6/YVQpyWI91s/s3++8SMKkgAGppnDqoYGwebJNEYRMp42X50o 7Q+U778pr21SIs0+FF7mPGklXh3M5woXkkEOPfkymB+lfFyCrq7NGh9sTCCdPy3U9tuT PeqfYyY5csbx3zk313BVyhW6ciyyDO8L4zkVarxl1jB0JCYwQ5jnppZ8Pvyy4z26rgsj LBf3BXbZFc8WeXOU2iDbxs14RHr1xs7zT+GCUxuzWSDm7tXTTQH3LBe4zCDFb+USPI2v j3MzIiqsm053x9wdC9YVT8nlOLL2iY/w1t0TN/md1vim98GQ14YnOAONHIGuGajALjbq zjAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vGCaRncP4WFM39bvzIL74x0FJxRrPRbjBsSoFV07grM=; b=DGs7oCzdK4FMYTLvB0Ecq9QY9ewgYspxwSEeKNmxRdNyVufsto3WhzSFgqNfcEr3jG Qk9hl/pd7+7WrbsNNOOK/DhzSBTh5MfYSdQVzrP1gphRwEgNRu1GBjc2qsq5JpGFp08l aEGMjc+WflV2QJWoIsw49S38UaF93clIVzxlVftjcSRt/SF3pttCnwufqQ1ISOd+P5rG /rHhNx7W0q5aoAIeA2Hhp4dZs4t8CPfnT0d1/Dhpm9BMT8ypm3yVE2/DQ/p26eXl9wO5 g47vjDQMlbA+4Kou8XU+w44OhgWM4gpw/mu2ZdMff580iG7/k1pTPsBArJa/LfiJ6ZBv 2htw== X-Gm-Message-State: AOAM530QfHBr0vi4knKt9ABxxNtQQ4nMQIu0cB2vStEFrA2wPJSGSeUV IRwwiaHgzwBD6seKbHXnxSAO+TgFLgNuTg== X-Google-Smtp-Source: ABdhPJw9DYN0EqS018LdZBQdGVyQz5vJqvv/6x3Pb2m+4aoLa3qbP4dc9UZl1exMeHfLpZZYxrUiYQ== X-Received: by 2002:a17:902:e04e:b029:12c:def4:56a3 with SMTP id x14-20020a170902e04eb029012cdef456a3mr9697775plx.76.1629340862558; Wed, 18 Aug 2021 19:41:02 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id m2sm1186954pfo.45.2021.08.18.19.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 19:41:02 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 18 Aug 2021 19:41:00 -0700 Message-Id: <20210819024100.1710184-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] eal: detach interrupt and worker threads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The EAL library does not wait (pthread_join) these threads so the should be detached so that library can release resources. This shows up when looking for memory leaks with tools like valgrind. Signed-off-by: Stephen Hemminger --- lib/eal/freebsd/eal.c | 3 +++ lib/eal/linux/eal.c | 6 ++++++ lib/eal/linux/eal_interrupts.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 6cee5ae369db..039e5fba4bd4 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -899,6 +899,9 @@ rte_eal_init(int argc, char **argv) sizeof(rte_cpuset_t), &lcore_config[i].cpuset); if (ret != 0) rte_panic("Cannot set affinity\n"); + + /* worker threads are never joined */ + pthread_detach(lcore_config[i].thread_id); } /* diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 3577eaeaa4f4..ad64557d453e 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1267,6 +1267,12 @@ rte_eal_init(int argc, char **argv) sizeof(rte_cpuset_t), &lcore_config[i].cpuset); if (ret != 0) rte_panic("Cannot set affinity\n"); + + /* worker threads are never joined */ + ret = pthread_detach(lcore_config[i].thread_id); + if (ret != 0) + RTE_LOG(DEBUG, EAL, + "Cannot detach lcore thread\n"); } /* diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c index 22b3b7bcd9a7..53a7bf5fbd4e 100644 --- a/lib/eal/linux/eal_interrupts.c +++ b/lib/eal/linux/eal_interrupts.c @@ -1175,6 +1175,9 @@ rte_eal_intr_init(void) "Failed to create thread for interrupt handling\n"); } + /* the interrupt thread is never joined */ + pthread_detach(intr_thread); + return ret; } -- 2.30.2