DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Cc: Fidaullah Noonari <fidaullah.noonari@emumba.com>,
	dev@dpdk.org,  "Burakov, Anatoly" <anatoly.burakov@intel.com>
Subject: Re: [PATCH v2] eal: change alloc_sz calculation which may cause unnecessarily allocation
Date: Mon, 26 Sep 2022 11:18:27 +0200	[thread overview]
Message-ID: <CAJFAV8zNjjSYW4VEiSA1vHMBqWfwuVaamM7Ngykud1waenLcdA@mail.gmail.com> (raw)
In-Reply-To: <20220922015212.03bfde66@sovereign>

On Thu, Sep 22, 2022 at 12:52 AM Dmitry Kozlyuk
<dmitry.kozliuk@gmail.com> wrote:
>
> 2022-09-21 15:35 (UTC+0200), David Marchand:
> > On Thu, Jul 28, 2022 at 8:03 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> > >
> > > 2022-07-28 14:41 (UTC+0500), Fidaullah Noonari:
> > > > The amount of memory to allocate from the system for heap expansion
> > > > was calculated in a way that may yield one page more than needed.
> > > > This could hit the allocation limit from the system or EAL.
> > > > The allocation would fail despite enough memory being available.
> > > >
> > > > In response to mail:
> > > > http://inbox.dpdk.org/dev/CAEYuUWCnRZNwxiOHEeTHw0Gy9aFJRLZtvAG9g=smuUvUEMcFXg@mail.gmail.com/
> > > >
> > > > Signed-off-by: Fidaullah Noonari <fidaullah.noonari@emumba.com>
> > >
> > > Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> > >
> >
> > Do you have a reproducer?
> > This sounds like a fix, should we backport it?
>
> We should, thanks for the catch.
>
> Reproducer:
>
> #include <rte_eal.h>
> #include <rte_malloc.h>
> #include <stdio.h>
>
> int
> main(int argc, char **argv)
> {
>         static const size_t hugepage_sz = 2 * (1 << 20);
>         static const size_t malloc_elem_overhead = 128;
>         static const size_t size = hugepage_sz - malloc_elem_overhead;
>         struct rte_malloc_socket_stats stats_before, stats_after;
>         size_t alloc_delta;
>         int ret;
>
>         ret = rte_eal_init(argc, argv);
>         if (ret < 0)
>                 rte_panic("Cannot init EAL\n");
>         rte_malloc_get_socket_stats(0, &stats_before);
>         (void)rte_malloc(NULL, size, 0);
>         rte_malloc_get_socket_stats(0, &stats_after);
>         alloc_delta = stats_after.heap_totalsz_bytes - stats_before.heap_totalsz_bytes;
>         puts(alloc_delta == hugepage_sz ? "fixed" : "affected");
>         rte_eal_cleanup();
>         return 0;

Thanks Dmitry.
I'll put a note about this reproducer in the commitlog.

> }
>


-- 
David Marchand


  reply	other threads:[~2022-09-26  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  9:41 Fidaullah Noonari
2022-07-28 18:03 ` Dmitry Kozlyuk
2022-09-21 13:35   ` David Marchand
2022-09-21 22:52     ` Dmitry Kozlyuk
2022-09-26  9:18       ` David Marchand [this message]
2022-09-26  9:20   ` David Marchand

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=CAJFAV8zNjjSYW4VEiSA1vHMBqWfwuVaamM7Ngykud1waenLcdA@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=fidaullah.noonari@emumba.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).