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 2B6AB45A7B for ; Tue, 1 Oct 2024 16:13:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E25A84027C; Tue, 1 Oct 2024 16:13:16 +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 406B240268 for ; Tue, 1 Oct 2024 16:13:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727791994; 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=i7yOPU39WBExsf9Z0f7MV5t1uk8Z7k6X0NdvH+xoZTA=; b=eThWZi7he2RpBbleVFb13eZtMizEPDLJIypY9t3SAjGjvE9TvPLD6R3RYFsIBH7r6AQi2j AZLcc48q+b+JmWBqYqIqSX2T4G0K6JEfRDRz4k3Hmqm7oYcY5QNdvy3Fm9PVWG0gSSZnm3 Cniy7Rc8ZLl7+GObvNqCrvymY2rTN40= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-TLXDzSokN5-s6wP__snJuA-1; Tue, 01 Oct 2024 10:13:13 -0400 X-MC-Unique: TLXDzSokN5-s6wP__snJuA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2fac0c2d49fso23974291fa.1 for ; Tue, 01 Oct 2024 07:13:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727791991; x=1728396791; 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=i7yOPU39WBExsf9Z0f7MV5t1uk8Z7k6X0NdvH+xoZTA=; b=oa7roV72iR9eJsJvCw5s2G1Bv4LZnT8W82lwjkBD0dOmXAVAlNW7KOkqmuKvE5DEIL tBrjdZ70kugfY/7JPcOSjcZ7dsJbVA6OnmqSRl6jaqw7mqKVfTcNz6VmaGdODbtdaeC2 E+MnAhPbVu2StxSMU/nqxD8tslwOTebcA6qm7zrUuveDJGuYLPsJcNhDD7kHYsR0t+cF Zy6DoFf3Jv2dHJQE0DxJNnhixWePjP4xkB6+vammDCgDBV9AKnrrrgVvGZ6RSBjIqwps rENrrd/vyF1uyWqMBIJtzrnho6ASmRscJgcnRkbhNrKfXwtc+3PN+vS8Sv2SEb5CjtVN RzGQ== X-Gm-Message-State: AOJu0YzryEJMm8WvX/Gw4oOk9Cfqu5/17qIMoTBbM9ZJUymqEytG/vLT q3cbuJzQSnvetWG4XbNPiOuWPrWYwMqNyQEpWX6/6ms+acoOZeZplpA3iWeSwjseGWmID3cF9SR VZ2tMJY+gfAWrqqjw0XnbTdsVlEavp2ISxm05Qu9PbnlGBG7BOgebBnjR4kVmDtNnQ+X73u8r2x FvFMZEtJ5QJ3o6iaCwgQ== X-Received: by 2002:a2e:a7c1:0:b0:2fa:ded3:f6aa with SMTP id 38308e7fff4ca-2faded3f8b0mr8744371fa.20.1727791991113; Tue, 01 Oct 2024 07:13:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9IpIUMOvEMqnQtGTO1VZgX30sFF89AHiv8awEQtlwvie0Jdvzf3QV5VZL7/BHClGhZZ8Uwck/rhLEd1RcSNI= X-Received: by 2002:a2e:a7c1:0:b0:2fa:ded3:f6aa with SMTP id 38308e7fff4ca-2faded3f8b0mr8744021fa.20.1727791990701; Tue, 01 Oct 2024 07:13:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Tue, 1 Oct 2024 16:12:59 +0200 Message-ID: Subject: Re: DPDK Memory Management Help To: Alan Beadle Cc: users@dpdk.org, Thomas Monjalon , Ferruh Yigit , Stephen Hemminger 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 Tue, Oct 1, 2024 at 2:26=E2=80=AFPM Alan Beadle wr= ote: > > Hi everyone, > > I'm working with DPDK and could use some advice about memory > management of the DPDK heap. > > I need to prevent DPDK from freeing the rte_mbuf buffers once the > corresponding packets have been sent with rte_eth_tx_burst(). My > application has local readers as well, and so I want to keep that data > around for them to read via shared memory. I would prefer to rely on > explicit calls to free any of these buffers. I can find plenty of > sources about rte_eth_tx_burst() freeing messages once they are sent, > but cannot find a way to override this behavior, or any mention of an > alternate call to send without freeing. > > This would let me avoid copying the data into a separate buffer just > for local readers and to let them read from the same buffers that DPDK > already requires., leading to a significant performance gain (less > memcpy). This seems like something that should be possible *without* > modifying DPDK, but I haven't figured out how yet. I know that I would > need to take care that the buffers are not freed prior to sending. This is a frequent question, so maybe we should update the doc. You can increment the refcnt on the mbuf in your application before calling rte_eth_tx_burst(). See rte_mbuf_refcnt_update(m, 1). It is then your application responsibility to call rte_pktmbuf_free() once it is done with the mbuf. --=20 David Marchand