DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Brijesh Singh <brijesh.s.singh@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] Mmap query
Date: Mon, 11 Oct 2021 22:38:40 +0300	[thread overview]
Message-ID: <20211011223840.32c95da3@sovereign> (raw)
In-Reply-To: <CAAQ1jEGTF=uOG=CeqZ1N8XD9i6DZgOHVw-fSQfDj7X27xNoi=w@mail.gmail.com>

Hi Brijesh,

2021-10-11 10:25 (UTC-0700), Brijesh Singh:
> Hi there,
> We are seeing high mmap time for 1G hugepage during eal memalloc init. Most
> time is spent for clearing page, each 4k size..
> It's not clear to me why clear huge pages is called? The code mmaps rte_map
> file with map_populate and map_shared this shouldn't cause page zeroing.
> I am curious to know how zeroing is forced?

The kernel clears all anonymous memory before handling it to the user space.
It is done for security: there may be sensitive data left by previous users
of those pages.

There is a pending patchset that aims to solve your issue:
https://mails.dpdk.org/archives/dev/2021-October/223723.html
Please see commit messages for some more explanations.

> As an alternative, I would like to memset from userspace. In my experiment
> we are noticing memset 1G file is faster that clear huge pages.

Can you share the numbers? From my experiments, mmap() is just a little
longer then memset() of the same amount of memory, apparently because the
kernel has some extra work to set up the mapping.

  reply	other threads:[~2021-10-11 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 17:25 Brijesh Singh
2021-10-11 19:38 ` Dmitry Kozlyuk [this message]
2021-10-12  0:24   ` Brijesh Singh

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=20211011223840.32c95da3@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=brijesh.s.singh@gmail.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).