get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/35733/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 35733,
    "url": "https://patches.dpdk.org/api/patches/35733/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/34f77569bf406fca23adc410ca768695c1a2c2b1.1520428025.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<34f77569bf406fca23adc410ca768695c1a2c2b1.1520428025.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/34f77569bf406fca23adc410ca768695c1a2c2b1.1520428025.git.anatoly.burakov@intel.com",
    "date": "2018-03-07T16:56:48",
    "name": "[dpdk-dev,v2,20/41] eal: add backend support for contiguous allocation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "28ea5e5de58cefe5c0f8bd79749bb723be08497d",
    "submitter": {
        "id": 4,
        "url": "https://patches.dpdk.org/api/people/4/?format=api",
        "name": "Burakov, Anatoly",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/34f77569bf406fca23adc410ca768695c1a2c2b1.1520428025.git.anatoly.burakov@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/35733/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/35733/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2E251AABD;\n\tWed,  7 Mar 2018 17:57:31 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 0B0465F5B\n\tfor <dev@dpdk.org>; Wed,  7 Mar 2018 17:57:16 +0100 (CET)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Mar 2018 08:57:16 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga007.fm.intel.com with ESMTP; 07 Mar 2018 08:57:13 -0800",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw27GvCH0032402; Wed, 7 Mar 2018 16:57:12 GMT",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w27GvCtN006756;\n\tWed, 7 Mar 2018 16:57:12 GMT",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w27GvCRr006752;\n\tWed, 7 Mar 2018 16:57:12 GMT"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.47,436,1515484800\"; d=\"scan'208\";a=\"22512719\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com,\n\tlaszlo.vadkeri@ericsson.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net,\n\tkonstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com,\n\tlouise.m.daly@intel.com, nelio.laranjeiro@6wind.com,\n\tyskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, \n\themant.agrawal@nxp.com, olivier.matz@6wind.com",
        "Date": "Wed,  7 Mar 2018 16:56:48 +0000",
        "Message-Id": "<34f77569bf406fca23adc410ca768695c1a2c2b1.1520428025.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1520428025.git.anatoly.burakov@intel.com>",
            "<cover.1520428025.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1520428025.git.anatoly.burakov@intel.com>",
            "<cover.1520083504.git.anatoly.burakov@intel.com>\n\t<cover.1520428025.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v2 20/41] eal: add backend support for contiguous\n\tallocation",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "No major changes, just add some checks in a few key places, and\na new parameter to pass around.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_memzone.c |  20 +++---\n lib/librte_eal/common/malloc_elem.c        | 101 ++++++++++++++++++++++-------\n lib/librte_eal/common/malloc_elem.h        |   4 +-\n lib/librte_eal/common/malloc_heap.c        |  57 ++++++++++------\n lib/librte_eal/common/malloc_heap.h        |   4 +-\n lib/librte_eal/common/rte_malloc.c         |   6 +-\n 6 files changed, 134 insertions(+), 58 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c\nindex 718dee8..75c7dd9 100644\n--- a/lib/librte_eal/common/eal_common_memzone.c\n+++ b/lib/librte_eal/common/eal_common_memzone.c\n@@ -98,7 +98,8 @@ find_heap_max_free_elem(int *s, unsigned align)\n \n static const struct rte_memzone *\n memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,\n-\t\tint socket_id, unsigned flags, unsigned align, unsigned bound)\n+\t\tint socket_id, unsigned int flags, unsigned int align,\n+\t\tunsigned int bound, bool contig)\n {\n \tstruct rte_memzone *mz;\n \tstruct rte_mem_config *mcfg;\n@@ -182,7 +183,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,\n \n \t/* allocate memory on heap */\n \tvoid *mz_addr = malloc_heap_alloc(NULL, requested_len, socket_id, flags,\n-\t\t\talign, bound);\n+\t\t\talign, bound, contig);\n \n \tif (mz_addr == NULL) {\n \t\trte_errno = ENOMEM;\n@@ -215,9 +216,9 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,\n }\n \n static const struct rte_memzone *\n-rte_memzone_reserve_thread_safe(const char *name, size_t len,\n-\t\t\t\tint socket_id, unsigned flags, unsigned align,\n-\t\t\t\tunsigned bound)\n+rte_memzone_reserve_thread_safe(const char *name, size_t len, int socket_id,\n+\t\tunsigned int flags, unsigned int align, unsigned int bound,\n+\t\tbool contig)\n {\n \tstruct rte_mem_config *mcfg;\n \tconst struct rte_memzone *mz = NULL;\n@@ -228,7 +229,7 @@ rte_memzone_reserve_thread_safe(const char *name, size_t len,\n \trte_rwlock_write_lock(&mcfg->mlock);\n \n \tmz = memzone_reserve_aligned_thread_unsafe(\n-\t\tname, len, socket_id, flags, align, bound);\n+\t\tname, len, socket_id, flags, align, bound, contig);\n \n \trte_rwlock_write_unlock(&mcfg->mlock);\n \n@@ -245,7 +246,7 @@ rte_memzone_reserve_bounded(const char *name, size_t len, int socket_id,\n \t\t\t    unsigned flags, unsigned align, unsigned bound)\n {\n \treturn rte_memzone_reserve_thread_safe(name, len, socket_id, flags,\n-\t\t\t\t\t       align, bound);\n+\t\t\t\t\t       align, bound, false);\n }\n \n /*\n@@ -257,7 +258,7 @@ rte_memzone_reserve_aligned(const char *name, size_t len, int socket_id,\n \t\t\t    unsigned flags, unsigned align)\n {\n \treturn rte_memzone_reserve_thread_safe(name, len, socket_id, flags,\n-\t\t\t\t\t       align, 0);\n+\t\t\t\t\t       align, 0, false);\n }\n \n /*\n@@ -269,7 +270,8 @@ rte_memzone_reserve(const char *name, size_t len, int socket_id,\n \t\t    unsigned flags)\n {\n \treturn rte_memzone_reserve_thread_safe(name, len, socket_id,\n-\t\t\t\t\t       flags, RTE_CACHE_LINE_SIZE, 0);\n+\t\t\t\t\t       flags, RTE_CACHE_LINE_SIZE, 0,\n+\t\t\t\t\t       false);\n }\n \n int\ndiff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c\nindex eabad66..d2dba35 100644\n--- a/lib/librte_eal/common/malloc_elem.c\n+++ b/lib/librte_eal/common/malloc_elem.c\n@@ -17,6 +17,7 @@\n #include <rte_common.h>\n #include <rte_spinlock.h>\n \n+#include \"eal_memalloc.h\"\n #include \"malloc_elem.h\"\n #include \"malloc_heap.h\"\n \n@@ -94,33 +95,88 @@ malloc_elem_insert(struct malloc_elem *elem)\n }\n \n /*\n+ * Attempt to find enough physically contiguous memory in this block to store\n+ * our data. Assume that element has at least enough space to fit in the data,\n+ * so we just check the page addresses.\n+ */\n+static bool\n+elem_check_phys_contig(struct rte_memseg_list *msl, void *start, size_t size)\n+{\n+\tuint64_t page_sz;\n+\tvoid *aligned_start, *end, *aligned_end;\n+\tsize_t aligned_len;\n+\n+\t/* figure out how many pages we need to fit in current data */\n+\tpage_sz = msl->hugepage_sz;\n+\taligned_start = RTE_PTR_ALIGN_FLOOR(start, page_sz);\n+\tend = RTE_PTR_ADD(start, size);\n+\taligned_end = RTE_PTR_ALIGN_CEIL(end, page_sz);\n+\n+\taligned_len = RTE_PTR_DIFF(aligned_end, aligned_start);\n+\n+\treturn eal_memalloc_is_contig(msl, aligned_start, aligned_len);\n+}\n+\n+/*\n  * calculate the starting point of where data of the requested size\n  * and alignment would fit in the current element. If the data doesn't\n  * fit, return NULL.\n  */\n static void *\n elem_start_pt(struct malloc_elem *elem, size_t size, unsigned align,\n-\t\tsize_t bound)\n+\t\tsize_t bound, bool contig)\n {\n-\tconst size_t bmask = ~(bound - 1);\n-\tuintptr_t end_pt = (uintptr_t)elem +\n-\t\t\telem->size - MALLOC_ELEM_TRAILER_LEN;\n-\tuintptr_t new_data_start = RTE_ALIGN_FLOOR((end_pt - size), align);\n-\tuintptr_t new_elem_start;\n-\n-\t/* check boundary */\n-\tif ((new_data_start & bmask) != ((end_pt - 1) & bmask)) {\n-\t\tend_pt = RTE_ALIGN_FLOOR(end_pt, bound);\n-\t\tnew_data_start = RTE_ALIGN_FLOOR((end_pt - size), align);\n-\t\tend_pt = new_data_start + size;\n-\t\tif (((end_pt - 1) & bmask) != (new_data_start & bmask))\n-\t\t\treturn NULL;\n-\t}\n+\tsize_t elem_size = elem->size;\n \n-\tnew_elem_start = new_data_start - MALLOC_ELEM_HEADER_LEN;\n+\t/*\n+\t * we're allocating from the end, so adjust the size of element by page\n+\t * size each time\n+\t */\n+\twhile (elem_size >= size) {\n+\t\tconst size_t bmask = ~(bound - 1);\n+\t\tuintptr_t end_pt = (uintptr_t)elem +\n+\t\t\t\telem_size - MALLOC_ELEM_TRAILER_LEN;\n+\t\tuintptr_t new_data_start = RTE_ALIGN_FLOOR((end_pt - size),\n+\t\t\t\talign);\n+\t\tuintptr_t new_elem_start;\n+\n+\t\t/* check boundary */\n+\t\tif ((new_data_start & bmask) != ((end_pt - 1) & bmask)) {\n+\t\t\tend_pt = RTE_ALIGN_FLOOR(end_pt, bound);\n+\t\t\tnew_data_start = RTE_ALIGN_FLOOR((end_pt - size),\n+\t\t\t\t\talign);\n+\t\t\tend_pt = new_data_start + size;\n+\n+\t\t\tif (((end_pt - 1) & bmask) != (new_data_start & bmask))\n+\t\t\t\treturn NULL;\n+\t\t}\n \n-\t/* if the new start point is before the exist start, it won't fit */\n-\treturn (new_elem_start < (uintptr_t)elem) ? NULL : (void *)new_elem_start;\n+\t\tnew_elem_start = new_data_start - MALLOC_ELEM_HEADER_LEN;\n+\n+\t\t/* if the new start point is before the exist start,\n+\t\t * it won't fit\n+\t\t */\n+\t\tif (new_elem_start < (uintptr_t)elem)\n+\t\t\treturn NULL;\n+\n+\t\tif (contig) {\n+\t\t\tsize_t new_data_size = end_pt - new_data_start;\n+\n+\t\t\t/*\n+\t\t\t * if physical contiguousness was requested and we\n+\t\t\t * couldn't fit all data into one physically contiguous\n+\t\t\t * block, try again with lower addresses.\n+\t\t\t */\n+\t\t\tif (!elem_check_phys_contig(elem->msl,\n+\t\t\t\t\t(void *) new_data_start,\n+\t\t\t\t\tnew_data_size)) {\n+\t\t\t\telem_size -= align;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t}\n+\t\treturn (void *) new_elem_start;\n+\t}\n+\treturn NULL;\n }\n \n /*\n@@ -129,9 +185,9 @@ elem_start_pt(struct malloc_elem *elem, size_t size, unsigned align,\n  */\n int\n malloc_elem_can_hold(struct malloc_elem *elem, size_t size,\tunsigned align,\n-\t\tsize_t bound)\n+\t\tsize_t bound, bool contig)\n {\n-\treturn elem_start_pt(elem, size, align, bound) != NULL;\n+\treturn elem_start_pt(elem, size, align, bound, contig) != NULL;\n }\n \n /*\n@@ -259,9 +315,10 @@ malloc_elem_free_list_remove(struct malloc_elem *elem)\n  */\n struct malloc_elem *\n malloc_elem_alloc(struct malloc_elem *elem, size_t size, unsigned align,\n-\t\tsize_t bound)\n+\t\tsize_t bound, bool contig)\n {\n-\tstruct malloc_elem *new_elem = elem_start_pt(elem, size, align, bound);\n+\tstruct malloc_elem *new_elem = elem_start_pt(elem, size, align, bound,\n+\t\t\tcontig);\n \tconst size_t old_elem_size = (uintptr_t)new_elem - (uintptr_t)elem;\n \tconst size_t trailer_size = elem->size - old_elem_size - size -\n \t\tMALLOC_ELEM_OVERHEAD;\ndiff --git a/lib/librte_eal/common/malloc_elem.h b/lib/librte_eal/common/malloc_elem.h\nindex 6d979d2..798472e 100644\n--- a/lib/librte_eal/common/malloc_elem.h\n+++ b/lib/librte_eal/common/malloc_elem.h\n@@ -123,7 +123,7 @@ malloc_elem_insert(struct malloc_elem *elem);\n  */\n int\n malloc_elem_can_hold(struct malloc_elem *elem, size_t size,\n-\t\tunsigned align, size_t bound);\n+\t\tunsigned int align, size_t bound, bool contig);\n \n /*\n  * reserve a block of data in an existing malloc_elem. If the malloc_elem\n@@ -131,7 +131,7 @@ malloc_elem_can_hold(struct malloc_elem *elem, size_t size,\n  */\n struct malloc_elem *\n malloc_elem_alloc(struct malloc_elem *elem, size_t size,\n-\t\tunsigned align, size_t bound);\n+\t\tunsigned int align, size_t bound, bool contig);\n \n /*\n  * free a malloc_elem block by adding it to the free list. If the\ndiff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c\nindex 87dc9ad..984e027 100644\n--- a/lib/librte_eal/common/malloc_heap.c\n+++ b/lib/librte_eal/common/malloc_heap.c\n@@ -94,7 +94,7 @@ malloc_heap_add_memory(struct malloc_heap *heap, struct rte_memseg_list *msl,\n  */\n static struct malloc_elem *\n find_suitable_element(struct malloc_heap *heap, size_t size,\n-\t\tunsigned flags, size_t align, size_t bound)\n+\t\tunsigned int flags, size_t align, size_t bound, bool contig)\n {\n \tsize_t idx;\n \tstruct malloc_elem *elem, *alt_elem = NULL;\n@@ -103,7 +103,8 @@ find_suitable_element(struct malloc_heap *heap, size_t size,\n \t\t\tidx < RTE_HEAP_NUM_FREELISTS; idx++) {\n \t\tfor (elem = LIST_FIRST(&heap->free_head[idx]);\n \t\t\t\t!!elem; elem = LIST_NEXT(elem, free_list)) {\n-\t\t\tif (malloc_elem_can_hold(elem, size, align, bound)) {\n+\t\t\tif (malloc_elem_can_hold(elem, size, align, bound,\n+\t\t\t\t\tcontig)) {\n \t\t\t\tif (check_hugepage_sz(flags,\n \t\t\t\t\t\telem->msl->hugepage_sz))\n \t\t\t\t\treturn elem;\n@@ -127,16 +128,16 @@ find_suitable_element(struct malloc_heap *heap, size_t size,\n  */\n static void *\n heap_alloc(struct malloc_heap *heap, const char *type __rte_unused, size_t size,\n-\t\tunsigned int flags, size_t align, size_t bound)\n+\t\tunsigned int flags, size_t align, size_t bound, bool contig)\n {\n \tstruct malloc_elem *elem;\n \n \tsize = RTE_CACHE_LINE_ROUNDUP(size);\n \talign = RTE_CACHE_LINE_ROUNDUP(align);\n \n-\telem = find_suitable_element(heap, size, flags, align, bound);\n+\telem = find_suitable_element(heap, size, flags, align, bound, contig);\n \tif (elem != NULL) {\n-\t\telem = malloc_elem_alloc(elem, size, align, bound);\n+\t\telem = malloc_elem_alloc(elem, size, align, bound, contig);\n \n \t\t/* increase heap's count of allocated elements */\n \t\theap->alloc_count++;\n@@ -147,14 +148,15 @@ heap_alloc(struct malloc_heap *heap, const char *type __rte_unused, size_t size,\n \n static int\n try_expand_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,\n-\t\tint socket, unsigned int flags, size_t align, size_t bound)\n+\t\tint socket, unsigned int flags, size_t align, size_t bound,\n+\t\tbool contig)\n {\n+\tsize_t map_len, data_start_offset;\n \tstruct rte_memseg_list *msl;\n \tstruct rte_memseg **ms;\n \tstruct malloc_elem *elem;\n-\tsize_t map_len;\n \tint i, n_pages, allocd_pages;\n-\tvoid *ret, *map_addr;\n+\tvoid *ret, *map_addr, *data_start;\n \n \talign = RTE_MAX(align, MALLOC_ELEM_HEADER_LEN);\n \tmap_len = RTE_ALIGN_CEIL(align + elt_size + MALLOC_ELEM_TRAILER_LEN,\n@@ -175,11 +177,22 @@ try_expand_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,\n \tmap_addr = ms[0]->addr;\n \tmsl = rte_mem_virt2memseg_list(map_addr);\n \n+\t/* check if we wanted contiguous memory but didn't get it */\n+\tdata_start_offset = RTE_ALIGN(MALLOC_ELEM_HEADER_LEN, align);\n+\tdata_start = RTE_PTR_ADD(ms[0]->addr, data_start_offset);\n+\tif (contig && !eal_memalloc_is_contig(msl, data_start,\n+\t\t\tn_pages * msl->hugepage_sz)) {\n+\t\tRTE_LOG(DEBUG, EAL, \"%s(): couldn't allocate physically contiguous space\\n\",\n+\t\t\t\t__func__);\n+\t\tgoto free_pages;\n+\t}\n+\n \t/* add newly minted memsegs to malloc heap */\n \telem = malloc_heap_add_memory(heap, msl, map_addr, map_len);\n \n \t/* try once more, as now we have allocated new memory */\n-\tret = find_suitable_element(heap, elt_size, flags, align, bound);\n+\tret = find_suitable_element(heap, elt_size, flags, align, bound,\n+\t\t\tcontig);\n \n \tif (ret == NULL)\n \t\tgoto free_elem;\n@@ -196,6 +209,7 @@ try_expand_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,\n \tmalloc_elem_hide_region(elem, map_addr, map_len);\n \theap->total_size -= map_len;\n \n+free_pages:\n \tfor (i = 0; i < n_pages; i++)\n \t\teal_memalloc_free_page(ms[i]);\n free_ms:\n@@ -223,7 +237,7 @@ compare_pagesz(const void *a, const void *b)\n \n static int\n alloc_mem_on_socket(size_t size, int socket, unsigned int flags, size_t align,\n-\t\tsize_t bound)\n+\t\tsize_t bound, bool contig)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tstruct malloc_heap *heap = &mcfg->malloc_heaps[socket];\n@@ -304,14 +318,14 @@ alloc_mem_on_socket(size_t size, int socket, unsigned int flags, size_t align,\n \t\t * sizes first, before resorting to best effort allocation.\n \t\t */\n \t\tif (!try_expand_heap(heap, pg_sz, size, socket, size_flags,\n-\t\t\t\talign, bound))\n+\t\t\t\talign, bound, contig))\n \t\t\treturn 0;\n \t}\n \tif (n_other_pg_sz == 0)\n \t\treturn -1;\n \n \t/* now, check if we can reserve anything with size hint */\n-\tret = find_suitable_element(heap, size, flags, align, bound);\n+\tret = find_suitable_element(heap, size, flags, align, bound, contig);\n \tif (ret != NULL)\n \t\treturn 0;\n \n@@ -323,7 +337,7 @@ alloc_mem_on_socket(size_t size, int socket, unsigned int flags, size_t align,\n \t\tuint64_t pg_sz = other_pg_sz[i];\n \n \t\tif (!try_expand_heap(heap, pg_sz, size, socket, flags,\n-\t\t\t\talign, bound))\n+\t\t\t\talign, bound, contig))\n \t\t\treturn 0;\n \t}\n \treturn -1;\n@@ -332,7 +346,7 @@ alloc_mem_on_socket(size_t size, int socket, unsigned int flags, size_t align,\n /* this will try lower page sizes first */\n static void *\n heap_alloc_on_socket(const char *type, size_t size, int socket,\n-\t\tunsigned int flags, size_t align, size_t bound)\n+\t\tunsigned int flags, size_t align, size_t bound, bool contig)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tstruct malloc_heap *heap = &mcfg->malloc_heaps[socket];\n@@ -345,7 +359,7 @@ heap_alloc_on_socket(const char *type, size_t size, int socket,\n \n \t/* for legacy mode, try once and with all flags */\n \tif (internal_config.legacy_mem) {\n-\t\tret = heap_alloc(heap, type, size, flags, align, bound);\n+\t\tret = heap_alloc(heap, type, size, flags, align, bound, contig);\n \t\tgoto alloc_unlock;\n \t}\n \n@@ -354,12 +368,12 @@ heap_alloc_on_socket(const char *type, size_t size, int socket,\n \t * we may still be able to allocate memory from appropriate page sizes,\n \t * we just need to request more memory first.\n \t */\n-\tret = heap_alloc(heap, type, size, size_flags, align, bound);\n+\tret = heap_alloc(heap, type, size, size_flags, align, bound, contig);\n \tif (ret != NULL)\n \t\tgoto alloc_unlock;\n \n-\tif (!alloc_mem_on_socket(size, socket, flags, align, bound)) {\n-\t\tret = heap_alloc(heap, type, size, flags, align, bound);\n+\tif (!alloc_mem_on_socket(size, socket, flags, align, bound, contig)) {\n+\t\tret = heap_alloc(heap, type, size, flags, align, bound, contig);\n \n \t\t/* this should have succeeded */\n \t\tif (ret == NULL)\n@@ -372,7 +386,7 @@ heap_alloc_on_socket(const char *type, size_t size, int socket,\n \n void *\n malloc_heap_alloc(const char *type, size_t size, int socket_arg,\n-\t\tunsigned int flags, size_t align, size_t bound)\n+\t\tunsigned int flags, size_t align, size_t bound, bool contig)\n {\n \tint socket, i;\n \tvoid *ret;\n@@ -393,7 +407,8 @@ malloc_heap_alloc(const char *type, size_t size, int socket_arg,\n \tif (socket >= RTE_MAX_NUMA_NODES)\n \t\treturn NULL;\n \n-\tret = heap_alloc_on_socket(type, size, socket, flags, align, bound);\n+\tret = heap_alloc_on_socket(type, size, socket, flags, align, bound,\n+\t\t\tcontig);\n \tif (ret != NULL || socket_arg != SOCKET_ID_ANY)\n \t\treturn ret;\n \n@@ -402,7 +417,7 @@ malloc_heap_alloc(const char *type, size_t size, int socket_arg,\n \t\tif (i == socket)\n \t\t\tcontinue;\n \t\tret = heap_alloc_on_socket(type, size, i, flags,\n-\t\t\t\talign, bound);\n+\t\t\t\talign, bound, contig);\n \t\tif (ret != NULL)\n \t\t\treturn ret;\n \t}\ndiff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h\nindex 292d578..03b8014 100644\n--- a/lib/librte_eal/common/malloc_heap.h\n+++ b/lib/librte_eal/common/malloc_heap.h\n@@ -5,6 +5,8 @@\n #ifndef MALLOC_HEAP_H_\n #define MALLOC_HEAP_H_\n \n+#include <stdbool.h>\n+\n #include <rte_malloc.h>\n #include <rte_malloc_heap.h>\n \n@@ -25,7 +27,7 @@ malloc_get_numa_socket(void)\n \n void *\n malloc_heap_alloc(const char *type, size_t size, int socket, unsigned int flags,\n-\t\tsize_t align, size_t bound);\n+\t\tsize_t align, size_t bound, bool contig);\n \n int\n malloc_heap_free(struct malloc_elem *elem);\ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex b0fe11c..5cd92d1 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -37,7 +37,8 @@ void rte_free(void *addr)\n  * Allocate memory on specified heap.\n  */\n void *\n-rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)\n+rte_malloc_socket(const char *type, size_t size, unsigned int align,\n+\t\tint socket_arg)\n {\n \t/* return NULL if size is 0 or alignment is not power-of-2 */\n \tif (size == 0 || (align && !rte_is_power_of_2(align)))\n@@ -50,8 +51,7 @@ rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)\n \tif (socket_arg >= RTE_MAX_NUMA_NODES)\n \t\treturn NULL;\n \n-\treturn malloc_heap_alloc(type, size, socket_arg, 0,\n-\t\t\talign == 0 ? 1 : align, 0);\n+\treturn malloc_heap_alloc(type, size, socket_arg, 0, align, 0, false);\n }\n \n /*\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "20/41"
    ]
}