DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>, Slava Ovsiienko <viacheslavo@oss.nvidia.com>,
	"Anatoly Burakov" <anatoly.burakov@intel.com>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH v6 2/3] eal: add memory pre-allocation from existing files
Date: Tue, 12 Oct 2021 21:09:31 +0000	[thread overview]
Message-ID: <CH0PR12MB5091E996851B30C36B7D614BB9B69@CH0PR12MB5091.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8ymPk=0Q+eKVvET4EN29C_496euHcLr951aOW7rE49ipg@mail.gmail.com>

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: 12 октября 2021 г. 20:33
> To: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Cc: dev <dev@dpdk.org>; Slava Ovsiienko <viacheslavo@nvidia.com>; Anatoly
> Burakov <anatoly.burakov@intel.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>
> Subject: Re: [dpdk-dev] [PATCH v6 2/3] eal: add memory pre-allocation from
> existing files
> 
> External email: Use caution opening links or attachments
> 
> 
> On Tue, Oct 12, 2021 at 5:55 PM Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> wrote:
> > > I have some trouble figuring the need for the list of files.
> > > Why not use a global knob --mem-clear-on-alloc for this behavior
> change?
> >
> > Moving memset() doesn't speed anything up, it's a forced step for the
> reasons below.
> > Currently, memory is cleared by the kernel when a page is mapped during
> an allocation.
> > This cannot be turned off in stock kernels. The issue is that initial
> > allocations are longer by the time needed to clear the pages, which is
> >90%. For the memory intended for DMA this time is just wasted. If
> allocations are large, application startup and restart take long. The only
> way to get hugepages mapped without the kernel clearing them is to map
> existing files in hugetlbfs. However, rte_zmalloc() needs to return clean
> memory, that's why we move memset() there. Memory intended for DMA is just
> never cleared this way. But memory freed and allocated again will be
> cleared again, unfortunately.
> 
> Writing my limited understanding, please correct me.
> 
> The --mem-file that is proposed does:
> - preallocate files which is something close to --socket-mem with the
> following differences
>   - --mem-file lets user decide on dpdk hugepage files names, which I
> think conflicts with --huge-dir and --file-prefix,
>   - --mem-file lets user device on hugepage size which I think could be
> achieved with some --huge-dir option,

The comparison to --socket-mem is valid, because preallocated files form the initial amount of memory allocated from the system. However, using --mem-file does not preclude DPDK from allocating more memory according to --huge-dir and --file-prefix when the application runs out of preallocated blocks.

> - bypasses unlink() of existing hugepage files which I had overlooked but
> is the main painpoint,
> - enforces "clear on alloc" in rte_malloc/rte_free.
> 
> 
> From this, I see two parts in this patch:
> - faster restart, reusing hugepage files as is (combination of not calling
> unlink() and doing "clear on alloc"),
>   This part is interesting, and I think a single knob for this would be
> enough.

In combination with rte_extmem* API this know would indeed allow to implement the feature in the app. However, the drawback is that all the logic to select hugepage size, NUMA, and names would need to be done from the app, probably with its own options. OTOH, there is already hugetlbfs and numactl to avoid apps duplicating this logic. Also, it's not only the fast restart, but also the fast initial start on a prepared system.

> - finegrained control of hugepage files, but it has the drawback of
> imposing primary/secondary run with the same options.
>   The second part seems complex to configure. I see conflicts with
> existing options, so it seems a good way to get caught up in the carpet
> (sorry if it translates badly from French :p).

I don't see why synchronizing memory options is a big issue.
Primary and secondary processes are inherently interdependent.

  reply	other threads:[~2021-10-12 21:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 12:49 [dpdk-dev] [PATCH 21.11 0/3] " Dmitry Kozlyuk
2021-07-05 12:49 ` [dpdk-dev] [PATCH 21.11 1/3] eal/linux: make hugetlbfs analysis reusable Dmitry Kozlyuk
2021-07-05 12:49 ` [dpdk-dev] [PATCH 21.11 2/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-07-05 12:49 ` [dpdk-dev] [PATCH 21.11 3/3] app/test: add allocator performance autotest Dmitry Kozlyuk
2021-07-16 11:08 ` [dpdk-dev] [PATCH 21.11 v2 0/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-07-16 11:08   ` [dpdk-dev] [PATCH 21.11 v2 1/3] eal/linux: make hugetlbfs analysis reusable Dmitry Kozlyuk
2021-07-16 11:08   ` [dpdk-dev] [PATCH 21.11 v2 2/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-07-16 11:08   ` [dpdk-dev] [PATCH 21.11 v2 3/3] app/test: add allocator performance autotest Dmitry Kozlyuk
2021-08-09  9:45   ` [dpdk-dev] [PATCH 21.11 v2 0/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-08-30  8:21     ` Dmitry Kozlyuk
2021-09-14 10:34   ` [dpdk-dev] [PATCH v3 " Dmitry Kozlyuk
2021-09-14 10:34     ` [dpdk-dev] [PATCH v3 1/3] eal/linux: make hugetlbfs analysis reusable Dmitry Kozlyuk
2021-09-14 12:48       ` John Levon
2021-09-14 12:57         ` Dmitry Kozlyuk
2021-09-16 12:08       ` John Levon
2021-09-14 10:34     ` [dpdk-dev] [PATCH v3 2/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-09-14 10:34     ` [dpdk-dev] [PATCH v3 3/3] app/test: add allocator performance autotest Dmitry Kozlyuk
2021-09-20 12:52     ` [dpdk-dev] [PATCH v4 0/3] eal: add memory pre-allocation from existing files dkozlyuk
2021-09-20 12:53       ` [dpdk-dev] [PATCH v4 1/3] eal/linux: make hugetlbfs analysis reusable dkozlyuk
2021-09-20 12:53       ` [dpdk-dev] [PATCH v4 2/3] eal: add memory pre-allocation from existing files dkozlyuk
2021-09-20 12:53       ` [dpdk-dev] [PATCH v4 3/3] app/test: add allocator performance autotest dkozlyuk
2021-09-21  8:16       ` [dpdk-dev] [PATCH v5 0/3] eal: add memory pre-allocation from existing files dkozlyuk
2021-09-21  8:16         ` [dpdk-dev] [PATCH v5 1/3] eal/linux: make hugetlbfs analysis reusable dkozlyuk
2021-09-22 13:52           ` John Levon
2021-10-05 17:36           ` Thomas Monjalon
2021-10-08 15:33             ` John Levon
2021-10-08 15:50               ` Dmitry Kozlyuk
2021-09-21  8:16         ` [dpdk-dev] [PATCH v5 2/3] eal: add memory pre-allocation from existing files dkozlyuk
2021-09-21  8:16         ` [dpdk-dev] [PATCH v5 3/3] app/test: add allocator performance autotest dkozlyuk
2021-10-11  8:56         ` [dpdk-dev] [PATCH v6 0/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-10-11  8:56           ` [dpdk-dev] [PATCH v6 1/3] eal/linux: make hugetlbfs analysis reusable Dmitry Kozlyuk
2021-10-13  8:16             ` David Marchand
2021-10-13  9:21               ` Dmitry Kozlyuk
2021-10-11  8:56           ` [dpdk-dev] [PATCH v6 2/3] eal: add memory pre-allocation from existing files Dmitry Kozlyuk
2021-10-12 15:37             ` David Marchand
2021-10-12 15:55               ` Dmitry Kozlyuk
2021-10-12 17:32                 ` David Marchand
2021-10-12 21:09                   ` Dmitry Kozlyuk [this message]
2021-10-13 10:18                     ` David Marchand
2021-11-08 14:27                       ` Dmitry Kozlyuk
2021-11-08 17:45                         ` David Marchand
2021-10-11  8:56           ` [dpdk-dev] [PATCH v6 3/3] app/test: add allocator performance autotest Dmitry Kozlyuk
2021-10-12 13:53             ` Aaron Conole
2021-10-12 14:48               ` Dmitry Kozlyuk
2021-10-15 13:47                 ` Aaron Conole
2021-10-11 18:52           ` [dpdk-dev] [PATCH v6 0/3] eal: add memory pre-allocation from existing files Thomas Monjalon
2021-10-11 21:12             ` [dpdk-dev] [dpdk-ci] " Lincoln Lavoie
2021-10-12  6:54               ` Thomas Monjalon

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=CH0PR12MB5091E996851B30C36B7D614BB9B69@CH0PR12MB5091.namprd12.prod.outlook.com \
    --to=dkozlyuk@oss.nvidia.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@oss.nvidia.com \
    /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).