From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 15CCAA0547;
	Mon, 30 Aug 2021 19:16:18 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D59F4410FC;
	Mon, 30 Aug 2021 19:16:17 +0200 (CEST)
Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178])
 by mails.dpdk.org (Postfix) with ESMTP id 0FE9D410FB
 for <dev@dpdk.org>; Mon, 30 Aug 2021 19:16:16 +0200 (CEST)
Received: by inbox.dpdk.org (Postfix, from userid 33)
 id F004BA0548; Mon, 30 Aug 2021 19:16:15 +0200 (CEST)
From: bugzilla@dpdk.org
To: dev@dpdk.org
Date: Mon, 30 Aug 2021 17:16:15 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: DPDK
X-Bugzilla-Component: core
X-Bugzilla-Version: 18.11
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: normal
X-Bugzilla-Who: maaaah@mail.ru
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: dev@dpdk.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
 op_sys bug_status bug_severity priority component assigned_to reporter
 target_milestone
Message-ID: <bug-800-3@http.bugs.dpdk.org/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
MIME-Version: 1.0
Subject: [dpdk-dev] [Bug 800] rte_malloc fails to allocate memory block,
 but succeeds allocating bigger block
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

https://bugs.dpdk.org/show_bug.cgi?id=3D800

            Bug ID: 800
           Summary: rte_malloc fails to allocate memory block, but
                    succeeds allocating bigger block
           Product: DPDK
           Version: 18.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: maaaah@mail.ru
  Target Milestone: ---

rte_malloc succeeds allocating some memory, but fails to allocate less amou=
nt
(both on "clean" heap). While the behavior could be explained, it looks
counterintuitive. Would be fine to have at least some hint to guarantee
allocation success.


Machine specs:

Virtualbox VM
2 CPU
8G RAM

Also can be reproduced on some hardware, will provide specs if needed.


OS specs:

# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

# uname -a
Linux test 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
x86_64 x86_64 GNU/Linux


Hugepages config:

# fgrep GRUB_CMDLINE_LINUX /etc/default/grub
GRUB_CMDLINE_LINUX=3D"crashkernel=3Dauto rd.lvm.lv=3Dcentos/root
rd.lvm.lv=3Dcentos/swap rhgb quiet default_hugepagesz=3D2M hugepagesz=3D2M
hugepages=3D2560"

# fgrep HugePages_ /proc/meminfo
HugePages_Total:    2560
HugePages_Free:     2560
HugePages_Rsvd:        0
HugePages_Surp:        0



DPDK 18.11.11 (LTS)

Built using make:

# curl https://fast.dpdk.org/rel/dpdk-18.11.11.tar.xz -O
# tar -xf dpdk-18.11.11.tar.xz
# cd dpdk-stable-18.11.11
# make T=3Dx86_64-native-linuxapp-gcc config
# make
# make install


Steps to reproduce:

#include <rte_eal.h>
#include <rte_errno.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv) {
        int result =3D rte_eal_init(argc, argv);
        if (result < 0) {
                printf("failed to init EAL: %s (%i)\n", strerror(rte_errno),
rte_errno);
                return result;
        }

        void *p =3D rte_malloc(NULL, 0xffffffff, 0);
        if (p) {
                printf("success\n");

                rte_free(p);
        } else {
                printf("failure\n");
        }

        p =3D rte_malloc(NULL, 0x100000000, 0);
        if (p) {
                printf("success\n");

                rte_free(p);
        } else {
                printf("failure\n");
        }
}


DPDK_HOME=3D/usr/local/share/dpdk/ RTE_SDK=3D/usr/local/share/dpdk/ make

./test-malloc --log-level 0


Expected result:

success
success


Actual result:

failure
success

--=20
You are receiving this mail because:
You are the assignee for the bug.=