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 C162D45ACD for ; Mon, 7 Oct 2024 08:52:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4767D402A5; Mon, 7 Oct 2024 08:52:54 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 6C4D840151 for ; Mon, 7 Oct 2024 08:52:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728283973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A8Jxg06eKCpX5SJwdaqXt5QkYqfaxoSolnfIL2l1joQ=; b=cZd2OP8v+oMb+/PYxv5XnUwyfiKz3xKHlI1gRj5DIukndYfTt92KnG1ZmhtXP29wCEtXQB xUA7aoe7b3qvxVw7g6Gti5GJ3bTmxzwCaQOTdW5IxUu+SDAT6q3auHrhsuAGZnk2VcIbKA 8ajamXND88R0j1onoTdSBO/Zqtckuqo= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-gF4b1_0yPimcTYqoYp4k5A-1; Mon, 07 Oct 2024 02:52:51 -0400 X-MC-Unique: gF4b1_0yPimcTYqoYp4k5A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-5398b9176dcso3547934e87.2 for ; Sun, 06 Oct 2024 23:52:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728283970; x=1728888770; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A8Jxg06eKCpX5SJwdaqXt5QkYqfaxoSolnfIL2l1joQ=; b=hOu3BIT7qs5j8t/f1QMfrSX1Fa0Ak3Cpgc4lmyZbWZ7UpAkduvpiP+FMRLXJIdL3aW 6/aZm9LeJJ/D8jVr+Y7c8qKb7d41iEob5bj0q+PJwmaUaieu74FjlBvoyjWg4cbJ9F7S 6oFWeUnIQPZwVdtoKNj5qYRYd5Lg7GUSRSJQaeXwBkrRDeP2rCINIH1L1UJ6mN3UsMUn MYzP35HJ6zwO0fsCi6NyHM9t/2nyG99lk+Zcco3jTvN4pb1OwGobAI38PJv7OBxiHjx2 qB1lPsIAdwUvq5Y3AMImc+6nSY0R+4bYxtBPFPhx4uJK7W2xzihsMdfLS369Qa3HDtNQ up/w== X-Gm-Message-State: AOJu0YyaCYomgz8wx8ItyXjoWEOS39M8j9Z2uAY8CngWjsAgcogUUFT7 VkWYGQqx7FtMYR0jjvB5mGPfx6/fFZPLt9KEoFijTsjzDvBtFh0CtRnwVMQWegEOS/ha8kqooLQ 45H2l1IJIs+ZJBDIo5A8oPQHnOwtMnL1xQxtpdcr7W7y0GshgazVXrlbZkLNEm3dKJI+/mmkCH4 bISjx12INdO4LjFn/5Qg== X-Received: by 2002:a05:6512:2248:b0:535:6aa9:9868 with SMTP id 2adb3069b0e04-539ab858d2cmr4666068e87.19.1728283969857; Sun, 06 Oct 2024 23:52:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1VNO9NMyPp4ylLq0buvsztbUizr1RakSfH+3JjxX9iUyiv2m/sopSgDbplbxBInkcI73oVNVT6//2x8vVWv4= X-Received: by 2002:a05:6512:2248:b0:535:6aa9:9868 with SMTP id 2adb3069b0e04-539ab858d2cmr4666058e87.19.1728283969401; Sun, 06 Oct 2024 23:52:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Mon, 7 Oct 2024 08:52:38 +0200 Message-ID: Subject: Re: Force driver to free sent buffers? To: Alan Beadle Cc: users@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org On Sun, Oct 6, 2024 at 6:39=E2=80=AFPM Alan Beadle wr= ote: > > Hi everyone, > > Based on my thread from last week, I am using rte_mbuf_refcnt_update() > to increment the mbuf refcnts so that the driver will not free buffers > before my local readers are done with them. > I am also maintaining a queue of mbufs that local readers are finished > with, and periodically using rte_mbuf_refcnt_read() to see if the > refcnt is 1 yet, so that they can be freed or reused. > > An aside: Is there any problem with reuse of mbufs? Without actually > freeing and re-allocating it, that is? I plan to do this in order to > avoid having to link new mbufs to other reused data structures in my > application. > > The current problem is as follows: My application has a separate > unrelated heap (special purpose and bounded in size) and this heap > runs out of memory after a brief time because of having to track so > many unfreed mbufs. It appears that none of the mbufs are being freed Would it help to store this per-mbuf tracking context into a private area? You can ask for a per-mbuf private area at the mempool creation, see priv_s= ize. https://doc.dpdk.org/api/rte__mbuf_8h.html#a593921f13307803b94bbb4e0932db96= 2 > by the driver after being sent, and it looks like it won't free them > until it runs out of descriptors, which is too long for my situation. > > I have confirmed that the packets are being sent (received on other PC > with wireshark) and should be freeable. Is there a way to force the > driver to free sent mbufs earlier than when it runs out of > descriptors? --=20 David Marchand