DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: "Lombardo, Ed" <Ed.Lombardo@netscout.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: Need help with reducing VIRT memory
Date: Fri, 3 May 2024 23:54:42 +0300	[thread overview]
Message-ID: <20240503235442.70b4b056@sovereign> (raw)
In-Reply-To: <CH3PR01MB8470E906BEAD84329B81818C8F1F2@CH3PR01MB8470.prod.exchangelabs.com>

2024-05-03 14:48 (UTC+0000), Lombardo, Ed:
> Hi Dmitry,
> I am not clear on the DPDK memory layout and how to tweak these #define values.  

Given your statement:

> Currently we configure 2x1G hugepages and single socket.

I suggest the following:

#define RTE_MAX_MEMSEG_LISTS       2  // see item 5 below
#define RTE_MAX_MEM_MB_PER_LIST 2024  // see item 4 below
#define RTE_MAX_MEMSEG_PER_LIST 1024  // ditto
#define RTE_MAX_MEM_MB_PER_TYPE 2048  // see item 2 below
#define RTE_MAX_MEMSEG_PER_TYPE 1024  // see item 3 below

Explanation:

1. There is one memory type: socket 0 + 1G hugepages.

2. There are 2 GB = 2048 MB memory of this type.

3. On x86, there may be 1G or 2M hugepages.
   If the latter size is ever used, 2 GB need 1024 of 2M hugepages.
   The cost of allowing 1024 memsegs instead of 2 is negligible.

4. Each hugepage is represented by a "memory segment" in DPDK.
   Memory segment list (MSL) is a virtually continuous span
   of memory segments with equal size.
   DPDK cannot allocate a block larger than an entire MSL.
   In order to be able to allocate a block of any size
   (subject to the limitations of the only memory type = 2GB),
   MSL must be as large as the amount of memory of this type.
   Hence, MSL maximums = memory type maximums.
   
5. There may be two memory types (socket 0 + 2M, socket 0 + 1G),
   so you need at least two MSLs available.

In my tests, VIRT = 3142 MB for testpmd with these settings.

> I want to limit how much DPDK grabs for memory, but grabs what it
> absolutely needs for our application.  I don't want DPDK to plan for any
> hot-plug or dynamic adjustments of hugepages.  Our configuration is static,
> we allocate hugepages, discover ports and initialize couple ring buffers
> and 1 Rx Q and 4 Tx Qs per port.  Max of 4 ports.

This is all irrelevant to EAL reservations of address space.

> My goal is to reduce our application VIRT memory by 80%.  Not clear which config variables to adjust.

I hope that the above addresses your need.
However, I suggest considering what me and Bruce have been explaining:
VIRT usage is not RAM usage and high VIRT is not an issue by itself.
It is not recent DPDK that is broken or unsuitable for your hardware.
It is something in your application or setup
that is incompatible with large virtual address space reservations.
If you could provide more details about what is failing for you
(which system call, which what parameters, etc.),
it would be much appreciated, because the issue is rare
and maybe DPDK could account for this case and work out of the box in future.

  parent reply	other threads:[~2024-05-03 20:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 19:05 Lombardo, Ed
2024-05-02 20:03 ` Dmitry Kozlyuk
2024-05-02 20:58   ` Lombardo, Ed
2024-05-03 14:48     ` Lombardo, Ed
2024-05-03 15:27       ` Bruce Richardson
2024-05-03 15:52         ` Bruce Richardson
2024-05-03 18:58           ` Morten Brørup
2024-05-03 20:07             ` Lombardo, Ed
2024-05-03 20:54       ` Dmitry Kozlyuk [this message]
2024-05-03 20:56         ` Dmitry Kozlyuk
2024-05-03 21:18           ` Lombardo, Ed
2024-05-04  6:51             ` Morten Brørup
2024-05-05  3:25           ` Lombardo, Ed
2024-05-05  9:35             ` Dmitry Kozlyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240503235442.70b4b056@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=Ed.Lombardo@netscout.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).