From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
"Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: [RFC] random: use per lcore state
Date: Mon, 11 Sep 2023 18:53:29 +0200 [thread overview]
Message-ID: <a8a038ac-e4cb-b86c-4ab5-a15c9deeb0ac@lysator.liu.se> (raw)
In-Reply-To: <20230911090634.05f8d9fd@fedora>
On 2023-09-11 18:06, Stephen Hemminger wrote:
> On Fri, 8 Sep 2023 09:04:29 +0200
> Mattias Rönnblom <hofors@lysator.liu.se> wrote:
>
>>> Also, right now the array is sized at 129 entries to allow for the
>>> maximum number of lcores. When the maximum is increased to 512 or
>>> 1024 the problem will get worse.
>>
>> Using TLS will penalize every thread in the process, not only EAL
>> threads and registered non-EAL threads, and worse: not only threads
>> that are using the API in question.
>>
>> Every thread will carry the TLS memory around, increasing the process
>> memory footprint.
>>
>> Thread creation will be slower, since TLS memory is allocated *and
>> initialized*, lazy user code-level initialization or not.
>>
>> On my particular Linux x86_64 system, pthread creation overhead looks
>> something like:
>>
>> 8 us w/o any user code-level use of TLS
>> 11 us w/ 16 kB of TLS
>> 314 us w/ 2 MB of TLS.
>
> Agree that TLS does cause potentially more pages to get allocated on
> thread creation, but that argument doesn't make sense here.
Sure. I was talking about the general concept of replacing per-lcore
static arrays with TLS.
I find the general applicability of the TLS pattern related because it
doesn't make sense to have an ad-hoc, opportunistic way to implement
essentially the same thing across the DPDK code base.
> The rand
> state is small, and DPDK applications should not be creating threads
> after startup. Thread creation is an expensive set of system calls.
I agree, and I would add that non-EAL threads will likely be few in
numbers, and should all be registered on creation, to assure they can
call DPDK APIs which require a lcore id.
That said, if application do create threads, DPDK shouldn't make the
thread creation order of magnitudes slower.
next prev parent reply other threads:[~2023-09-11 16:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 17:20 Stephen Hemminger
2023-09-06 17:54 ` Morten Brørup
2023-09-11 16:04 ` Stephen Hemminger
2023-09-11 16:37 ` Morten Brørup
2023-09-06 18:16 ` Morten Brørup
2023-09-06 19:55 ` Stephen Hemminger
2023-09-06 20:12 ` Mattias Rönnblom
2023-09-06 20:02 ` Mattias Rönnblom
2023-09-06 23:00 ` Stephen Hemminger
2023-09-08 7:04 ` Mattias Rönnblom
2023-09-11 16:06 ` Stephen Hemminger
2023-09-11 16:53 ` Mattias Rönnblom [this message]
2023-09-09 0:13 ` Konstantin Ananyev
2023-09-09 6:45 ` Mattias Rönnblom
2023-09-09 11:23 ` Morten Brørup
2023-09-11 9:00 ` Mattias Rönnblom
2023-09-11 16:02 ` Stephen Hemminger
2023-09-09 11:32 ` Stephen Hemminger
2023-09-10 13:26 ` Konstantin Ananyev
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=a8a038ac-e4cb-b86c-4ab5-a15c9deeb0ac@lysator.liu.se \
--to=hofors@lysator.liu.se \
--cc=dev@dpdk.org \
--cc=mattias.ronnblom@ericsson.com \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.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).