Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/32465/?format=api
https://patches.dpdk.org/api/patches/32465/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/65d0cc5505897c256559e5788fea00777d85699a.1513681966.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": "<65d0cc5505897c256559e5788fea00777d85699a.1513681966.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/65d0cc5505897c256559e5788fea00777d85699a.1513681966.git.anatoly.burakov@intel.com", "date": "2017-12-19T11:14:45", "name": "[dpdk-dev,RFC,v2,18/23] eal: add rte_malloc support for allocating contiguous memory", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "dcac21da18377b5a75787696809c62d8e2e094fd", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/65d0cc5505897c256559e5788fea00777d85699a.1513681966.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/32465/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/32465/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 6C51D1B1D6;\n\tTue, 19 Dec 2017 12:15:19 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 611471D7\n\tfor <dev@dpdk.org>; Tue, 19 Dec 2017 12:14:56 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2017 03:14:55 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 19 Dec 2017 03:14:53 -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\tvBJBEr3D003141; Tue, 19 Dec 2017 11:14:53 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id vBJBErJN010309;\n\tTue, 19 Dec 2017 11:14:53 GMT", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id vBJBErlh010305;\n\tTue, 19 Dec 2017 11:14:53 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.45,426,1508828400\"; d=\"scan'208\";a=\"14827542\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com,\n\tkeith.wiles@intel.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net", "Date": "Tue, 19 Dec 2017 11:14:45 +0000", "Message-Id": "<65d0cc5505897c256559e5788fea00777d85699a.1513681966.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1513681966.git.anatoly.burakov@intel.com>", "<cover.1513681966.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1513681966.git.anatoly.burakov@intel.com>", "<cover.1513681966.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [RFC v2 18/23] eal: add rte_malloc support for\n\tallocating contiguous memory", "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": "This adds a new set of _contig API's to rte_malloc.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/include/rte_malloc.h | 181 +++++++++++++++++++++++++++++\n lib/librte_eal/common/rte_malloc.c | 63 ++++++++++\n 2 files changed, 244 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h\nindex 5d4c11a..c132d33 100644\n--- a/lib/librte_eal/common/include/rte_malloc.h\n+++ b/lib/librte_eal/common/include/rte_malloc.h\n@@ -242,6 +242,187 @@ void *\n rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket);\n \n /**\n+ * This function allocates memory from the huge-page area of memory. The memory\n+ * is not cleared. In NUMA systems, the memory allocated resides on the same\n+ * NUMA socket as the core that calls this function.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param size\n+ * Size (in bytes) to be allocated.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_malloc_contig(const char *type, size_t size, unsigned align);\n+\n+/**\n+ * Allocate zero'ed memory from the heap.\n+ *\n+ * Equivalent to rte_malloc() except that the memory zone is\n+ * initialised with zeros. In NUMA systems, the memory allocated resides on the\n+ * same NUMA socket as the core that calls this function.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param size\n+ * Size (in bytes) to be allocated.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must obviously be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_zmalloc_contig(const char *type, size_t size, unsigned align);\n+\n+/**\n+ * Replacement function for calloc(), using huge-page memory. Memory area is\n+ * initialised with zeros. In NUMA systems, the memory allocated resides on the\n+ * same NUMA socket as the core that calls this function.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param num\n+ * Number of elements to be allocated.\n+ * @param size\n+ * Size (in bytes) of a single element.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must obviously be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_calloc_contig(const char *type, size_t num, size_t size, unsigned align);\n+\n+/**\n+ * Replacement function for realloc(), using huge-page memory. Reserved area\n+ * memory is resized, preserving contents. In NUMA systems, the new area\n+ * resides on the same NUMA socket as the old area.\n+ *\n+ * @param ptr\n+ * Pointer to already allocated memory\n+ * @param size\n+ * Size (in bytes) of new area. If this is 0, memory is freed.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must obviously be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the reallocated memory.\n+ */\n+void *\n+rte_realloc_contig(void *ptr, size_t size, unsigned align);\n+\n+/**\n+ * This function allocates memory from the huge-page area of memory. The memory\n+ * is not cleared.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param size\n+ * Size (in bytes) to be allocated.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @param socket\n+ * NUMA socket to allocate memory on. If SOCKET_ID_ANY is used, this function\n+ * will behave the same as rte_malloc().\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_malloc_socket_contig(const char *type, size_t size, unsigned align, int socket);\n+\n+/**\n+ * Allocate zero'ed memory from the heap.\n+ *\n+ * Equivalent to rte_malloc() except that the memory zone is\n+ * initialised with zeros.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param size\n+ * Size (in bytes) to be allocated.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must obviously be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @param socket\n+ * NUMA socket to allocate memory on. If SOCKET_ID_ANY is used, this function\n+ * will behave the same as rte_zmalloc().\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_zmalloc_socket_contig(const char *type, size_t size, unsigned align, int socket);\n+\n+/**\n+ * Replacement function for calloc(), using huge-page memory. Memory area is\n+ * initialised with zeros.\n+ *\n+ * @param type\n+ * A string identifying the type of allocated objects (useful for debug\n+ * purposes, such as identifying the cause of a memory leak). Can be NULL.\n+ * @param num\n+ * Number of elements to be allocated.\n+ * @param size\n+ * Size (in bytes) of a single element.\n+ * @param align\n+ * If 0, the return is a pointer that is suitably aligned for any kind of\n+ * variable (in the same manner as malloc()).\n+ * Otherwise, the return is a pointer that is a multiple of *align*. In\n+ * this case, it must obviously be a power of two. (Minimum alignment is the\n+ * cacheline size, i.e. 64-bytes)\n+ * @param socket\n+ * NUMA socket to allocate memory on. If SOCKET_ID_ANY is used, this function\n+ * will behave the same as rte_calloc().\n+ * @return\n+ * - NULL on error. Not enough memory, or invalid arguments (size is 0,\n+ * align is not a power of two).\n+ * - Otherwise, the pointer to the allocated object.\n+ */\n+void *\n+rte_calloc_socket_contig(const char *type, size_t num, size_t size, unsigned align, int socket);\n+\n+/**\n * Frees the memory space pointed to by the provided pointer.\n *\n * This pointer must have been returned by a previous call to\ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex 623725e..e8ad085 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -96,6 +96,15 @@ rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)\n }\n \n /*\n+ * Allocate memory on specified heap.\n+ */\n+void *\n+rte_malloc_socket_contig(const char *type, size_t size, unsigned align, int socket_arg)\n+{\n+\treturn malloc_socket(type, size, align, socket_arg, true);\n+}\n+\n+/*\n * Allocate memory on default heap.\n */\n void *\n@@ -105,6 +114,15 @@ rte_malloc(const char *type, size_t size, unsigned align)\n }\n \n /*\n+ * Allocate memory on default heap.\n+ */\n+void *\n+rte_malloc_contig(const char *type, size_t size, unsigned align)\n+{\n+\treturn rte_malloc_socket_contig(type, size, align, SOCKET_ID_ANY);\n+}\n+\n+/*\n * Allocate zero'd memory on specified heap.\n */\n void *\n@@ -114,6 +132,15 @@ rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)\n }\n \n /*\n+ * Allocate zero'd memory on specified heap.\n+ */\n+void *\n+rte_zmalloc_socket_contig(const char *type, size_t size, unsigned align, int socket)\n+{\n+\treturn rte_malloc_socket_contig(type, size, align, socket);\n+}\n+\n+/*\n * Allocate zero'd memory on default heap.\n */\n void *\n@@ -123,6 +150,15 @@ rte_zmalloc(const char *type, size_t size, unsigned align)\n }\n \n /*\n+ * Allocate zero'd memory on default heap.\n+ */\n+void *\n+rte_zmalloc_contig(const char *type, size_t size, unsigned align)\n+{\n+\treturn rte_zmalloc_socket_contig(type, size, align, SOCKET_ID_ANY);\n+}\n+\n+/*\n * Allocate zero'd memory on specified heap.\n */\n void *\n@@ -132,6 +168,15 @@ rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int\n }\n \n /*\n+ * Allocate zero'd physically contiguous memory on specified heap.\n+ */\n+void *\n+rte_calloc_socket_contig(const char *type, size_t num, size_t size, unsigned align, int socket)\n+{\n+\treturn rte_zmalloc_socket_contig(type, num * size, align, socket);\n+}\n+\n+/*\n * Allocate zero'd memory on default heap.\n */\n void *\n@@ -141,6 +186,15 @@ rte_calloc(const char *type, size_t num, size_t size, unsigned align)\n }\n \n /*\n+ * Allocate zero'd physically contiguous memory on default heap.\n+ */\n+void *\n+rte_calloc_contig(const char *type, size_t num, size_t size, unsigned align)\n+{\n+\treturn rte_zmalloc_contig(type, num * size, align);\n+}\n+\n+/*\n * Resize allocated memory.\n */\n static void *\n@@ -180,6 +234,15 @@ rte_realloc(void *ptr, size_t size, unsigned align)\n \treturn do_realloc(ptr, size, align, false);\n }\n \n+/*\n+ * Resize allocated physically contiguous memory.\n+ */\n+void *\n+rte_realloc_contig(void *ptr, size_t size, unsigned align)\n+{\n+\treturn do_realloc(ptr, size, align, true);\n+}\n+\n int\n rte_malloc_validate(const void *ptr, size_t *size)\n {\n", "prefixes": [ "dpdk-dev", "RFC", "v2", "18/23" ] }{ "id": 32465, "url": "