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 5D4A74602B; Thu, 9 Jan 2025 13:11:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09E1C40BA5; Thu, 9 Jan 2025 13:11:48 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 0BDB340B94 for ; Thu, 9 Jan 2025 13:11:47 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 9BEBA20DC8; Thu, 9 Jan 2025 13:11:46 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: questions about pinned external buffers X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Thu, 9 Jan 2025 13:11:41 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F99F@smartserver.smartshare.dk> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: questions about pinned external buffers Thread-Index: Adtij6SnfyLI8A1BTh26CsCUpTAgKg== From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Shahaf Shuler" , "Viacheslav Ovsiienko" , Cc: "Olivier Matz" , 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 Pinned external buffers were introduced with this patch: https://git.dpdk.org/dpdk/commit/lib/librte_mbuf/rte_mbuf.h?id=3D6ef1107a= d4c6d4fcb6be627367ee0b97bb13e822 Question 1: Please confirm that the mbuf's pinned external buffer's refcnt is = supposed to be 1 when an mbuf is returned to the mempool? If so, the below assertion should be updated for completion: rte_mbuf_raw_free(struct rte_mbuf *m) { RTE_ASSERT(!RTE_MBUF_CLONED(m) && - (!RTE_MBUF_HAS_EXTBUF(m) || RTE_MBUF_HAS_PINNED_EXTBUF(m))); + (!RTE_MBUF_HAS_EXTBUF(m) || + (RTE_MBUF_HAS_PINNED_EXTBUF(m) && + rte_mbuf_ext_refcnt_read(m->shinfo) =3D=3D 1))); __rte_mbuf_raw_sanity_check(m); rte_mempool_put(m->pool, m); } The increased performance cost should be acceptable for debug builds = (i.e. with assertions enabled). Question 2: Could this assertion be moved to __rte_mbuf_raw_sanity_check()? I'm working on a new rte_mbuf_raw_free_bulk() function, for use with = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; and if the assertion is not moved to = __rte_mbuf_raw_sanity_check(), it needs to be copy-pasted into the new = raw_free_bulk() function too.