[dpdk-dev] [Bug 800] rte_malloc fails to allocate memory block, but succeeds allocating bigger block

bugzilla at dpdk.org bugzilla at dpdk.org
Mon Aug 30 19:16:15 CEST 2021


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

            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 at dpdk.org
          Reporter: maaaah at mail.ru
  Target Milestone: ---

rte_malloc succeeds allocating some memory, but fails to allocate less amount
(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="crashkernel=auto rd.lvm.lv=centos/root
rd.lvm.lv=centos/swap rhgb quiet default_hugepagesz=2M hugepagesz=2M
hugepages=2560"

# 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=x86_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 = 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 = rte_malloc(NULL, 0xffffffff, 0);
        if (p) {
                printf("success\n");

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

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

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


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

./test-malloc --log-level 0


Expected result:

success
success


Actual result:

failure
success

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


More information about the dev mailing list