From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, thomas@monjalon.net, frode.nordahl@canonical.com,
mattias.ronnblom@ericsson.com
Subject: Re: [PATCH 0/3] Defer lcore variables allocation
Date: Mon, 9 Dec 2024 16:39:21 +0100 [thread overview]
Message-ID: <a707f990-5254-44c0-a61d-da56166e2d45@lysator.liu.se> (raw)
In-Reply-To: <CAJFAV8x8ydbkEJLw8KgKEiWp8dKOybJYpvqxC7SZQYUffLgYrg@mail.gmail.com>
On 2024-12-09 12:03, David Marchand wrote:
> Hello,
>
> On Fri, Dec 6, 2024 at 12:02 PM Mattias Rönnblom <hofors@lysator.liu.se> wrote:
>>
>> On 2024-12-05 18:57, David Marchand wrote:
>>> As I had reported in rc2, the lcore variables allocation have a
>>> noticeable impact on applications consuming DPDK, even when such
>>> applications does not use DPDK, or use features associated to
>>> some lcore variables.
>>>
>>> While the amount has been reduced in a rush before rc2,
>>> there are still cases when the increased memory footprint is noticed
>>> like in scaling tests.
>>> See https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/2090931
>>>
>>
>> What this bug report fails to mention is that it only affects
>> applications using locked memory.
>
> - By locked memory, are you referring to mlock() and friends?
> No ovsdb binary calls them, only the datapath cares about mlocking.
>
>
> - At a minimum, I understand the lcore var change introduced an
> increase in memory of 4kB * 128 (getpagesize() * RTE_MAX_LCORES),
> since lcore_var_alloc() calls memset() of the lcore var size, for
> every lcore.
>
Yes, that is my understanding. It's also consistent with the
measurements I've posted on this list.
> In this unit test where 1000 processes are kept alive in parallel,
> this means memory consumption increased by 512k * 1000, so ~500M at
> least.
> This amount of memory is probably significant in a resource-restrained
> env like a (Ubuntu) CI.
>
>
I wouldn't expect thousands of concurrent processes in a
resource-constrained system. Sounds wasteful indeed. But sure, there may
well be scenarios where this make sense.
> - I went and traced this unit tests on my laptop by monitoring
> kmem:mm_page_alloc, though there may be a better metrics when it comes
> to memory consumption.
>
> # dir=build; perf stat -e kmem:mm_page_alloc -- tests/testsuite -C
> $dir/tests AUTOTEST_PATH=$dir/utilities:$dir/vswitchd:$dir/ovsdb:$dir/vtep:$dir/tests:$dir/ipsec::
> 2154
>
> Which gives:
> - 1 635 489 kmem:mm_page_alloc for v23.11
> - 5 777 043 kmem:mm_page_alloc for v24.11
>
Interesting. What is vm.overcommit_memory set to?
How much does process RSS differ between the two version?
This is what I get with a hello world type test program, which links to
DPDK, but have not yet called rte_eal_init():
DPDK Version Linking RSS [kB]
22.11 Static 8448
23.11 Static 8192
9bbd44d638* Static 8192
18b5049ab4** Static 8704
24.11 Static 9472
22.11 Dynamic 2304
9bbd44d638* Dynamic 2304
18b5049ab4** Dynamic 2816
24.11 Dynamic 2816
No DPDK - 1024
* 24.11rc commit before lcore variables patch set.
* Last commit in the initial lcore variables patch set.
Ubuntu 24.04 w/ all defaults. --no-huge was used.
In the dynamic case, you see the expected ~0.5 MB increase in foot print
for yet-to-be-used lcore variables.
In the static case, you also see a ~0.5 MB bump with the lcore
variables, and then another ~0.5 MB bump (for some other reason) until
24.11.
(The dynamic hello world program only ends up being dynamically linked
to very few of the DPDK shared objects, so ymmv).
> There is a 4M difference, where I would expect 128k.
> So something more happens, than a simple page allocation per lcore,
> though I fail to understand what.
>
>
> Btw, just focusing on lcore var, I did two more tests:
> - 1 606 998 kmem:mm_page_alloc for v24.11 + revert all lcore var changes.
> - 1 634 606 kmem:mm_page_alloc for v24.11 + current series with
> postponed allocations.
>
>
If one move initialization to shared object constructors (from having
been at some later time), and then end up not running that
initialization code at all (e.g., DPDK is not used), those code pages
will increase RSS. That might well hurt more than the lcore variable
memory itself, depending on how much code is run.
However, such read-only pages can be replaced with something more useful
if the system is under memory pressure, so they aren't really a big
issue as far as (real) memory footprint is concerned.
Just linking to DPDK (and its dependencies) already came with a 1-7 MB
RSS penalty, prior to lcore variables. I wonder how much of that goes
away if all RTE_INIT() type constructors are removed.
next prev parent reply other threads:[~2024-12-09 15:39 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 17:57 [PATCH 0/3] Defer lcore variables allocation David Marchand
2024-12-05 17:57 ` [PATCH 1/3] random: defer seeding to EAL init David Marchand
2024-12-06 11:09 ` Mattias Rönnblom
2024-12-16 9:38 ` Burakov, Anatoly
2024-12-05 17:57 ` [PATCH 2/3] power: defer lcore variable allocation David Marchand
2024-12-06 11:29 ` Mattias Rönnblom
2024-12-12 7:57 ` David Marchand
2024-12-13 6:58 ` Mattias Rönnblom
2024-12-16 10:02 ` David Marchand
2024-12-05 17:57 ` [PATCH 3/3] eal/x86: defer power intrinsics " David Marchand
2024-12-06 11:32 ` Mattias Rönnblom
2024-12-06 11:01 ` [PATCH 0/3] Defer lcore variables allocation Mattias Rönnblom
2024-12-06 15:55 ` Thomas Monjalon
2024-12-10 17:09 ` Stephen Hemminger
2024-12-09 11:03 ` David Marchand
2024-12-09 15:39 ` Mattias Rönnblom [this message]
2024-12-09 17:40 ` David Marchand
2024-12-10 9:41 ` Mattias Rönnblom
2024-12-16 10:01 ` Burakov, Anatoly
2024-12-16 9:42 ` Burakov, Anatoly
2024-12-16 9:49 ` David Marchand
2024-12-17 9:06 ` David Marchand
2024-12-18 20:10 ` Mattias Rönnblom
2024-12-17 8:59 ` [PATCH v2 0/5] " David Marchand
2024-12-17 8:59 ` [PATCH v2 1/5] eal: check lcore variable handle David Marchand
2024-12-18 11:18 ` Burakov, Anatoly
2024-12-17 8:59 ` [PATCH v2 2/5] random: defer seeding to EAL init David Marchand
2024-12-18 16:35 ` Stephen Hemminger
2024-12-18 17:03 ` Mattias Rönnblom
2024-12-17 8:59 ` [PATCH v2 3/5] power: defer lcore variable allocation David Marchand
2024-12-18 11:17 ` Burakov, Anatoly
2024-12-17 8:59 ` [PATCH v2 4/5] power: reduce memory footprint of per-lcore state David Marchand
2024-12-18 11:17 ` Burakov, Anatoly
2024-12-17 8:59 ` [PATCH v2 5/5] eal/x86: defer power intrinsics variable allocation David Marchand
2024-12-18 11:17 ` Burakov, Anatoly
2024-12-19 16:19 ` [PATCH v2 0/5] Defer lcore variables allocation Frode Nordahl
2025-02-10 21:31 ` [PATCH v3 " David Marchand
2025-02-10 21:31 ` [PATCH v3 1/5] eal: check lcore variable handle David Marchand
2025-02-10 21:31 ` [PATCH v3 2/5] random: defer seeding to EAL init David Marchand
2025-02-10 21:31 ` [PATCH v3 3/5] power: defer lcore variable allocation David Marchand
2025-02-10 21:31 ` [PATCH v3 4/5] power: reduce memory footprint of per-lcore state David Marchand
2025-02-10 21:31 ` [PATCH v3 5/5] eal/x86: defer power intrinsics variable allocation David Marchand
2025-02-11 13:01 ` [PATCH v3 0/5] Defer lcore variables allocation David Marchand
2025-02-12 0:47 ` fengchengwen
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=a707f990-5254-44c0-a61d-da56166e2d45@lysator.liu.se \
--to=hofors@lysator.liu.se \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=frode.nordahl@canonical.com \
--cc=mattias.ronnblom@ericsson.com \
--cc=thomas@monjalon.net \
/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).