Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/39170/?format=api
https://patches.dpdk.org/api/patches/39170/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/73e35ca9ce462ab097c6ca8e7cbfdd5b8bc06c1d.1525086045.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": "<73e35ca9ce462ab097c6ca8e7cbfdd5b8bc06c1d.1525086045.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/73e35ca9ce462ab097c6ca8e7cbfdd5b8bc06c1d.1525086045.git.anatoly.burakov@intel.com", "date": "2018-04-30T11:21:43", "name": "[dpdk-dev,v2,2/2] mem: unmap unneeded space", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "cc0e665ae8def4bcce690da8d2f220a635db3e9d", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/73e35ca9ce462ab097c6ca8e7cbfdd5b8bc06c1d.1525086045.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/39170/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/39170/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 94B781DB3;\n\tMon, 30 Apr 2018 13:21:50 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id DA5BB10BD\n\tfor <dev@dpdk.org>; Mon, 30 Apr 2018 13:21:46 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Apr 2018 04:21:44 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga002.fm.intel.com with ESMTP; 30 Apr 2018 04:21:43 -0700", "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\tw3UBLhf7016599; Mon, 30 Apr 2018 12:21:43 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w3UBLh4K022785;\n\tMon, 30 Apr 2018 12:21:43 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w3UBLhjO022781;\n\tMon, 30 Apr 2018 12:21:43 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.49,346,1520924400\"; d=\"scan'208\";a=\"41760915\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "bruce.richardson@intel.com", "Date": "Mon, 30 Apr 2018 12:21:43 +0100", "Message-Id": "<73e35ca9ce462ab097c6ca8e7cbfdd5b8bc06c1d.1525086045.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<fb6d9b6f3bbead5f9ab3e9906814d35431b9edf5.1525086045.git.anatoly.burakov@intel.com>", "<be863f870fc02ea6464d15c87fa43e9d274f3240.1524155435.git.anatoly.burakov@intel.com>" ], "References": [ "<fb6d9b6f3bbead5f9ab3e9906814d35431b9edf5.1525086045.git.anatoly.burakov@intel.com>", "<be863f870fc02ea6464d15c87fa43e9d274f3240.1524155435.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 2/2] mem: unmap unneeded space", "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": "When we ask to reserve virtual areas, we usually include\nalignment in the mapping size, and that memory ends up\nbeing wasted. Wasting a gigabyte of VA space while trying to\nreserve one gigabyte is pretty expensive on 32-bit, so after\nwe're done mapping, unmap unneeded space.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n v2:\n - Split fix for size_t overflow into separate patch\n - Improve readability of unmapping code\n - Added comment explaining why unmapping is done\n\n lib/librte_eal/common/eal_common_memory.c | 26 +++++++++++++++++++++++++-\n 1 file changed, 25 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 0ac7b33..60aed4a 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -121,8 +121,32 @@ eal_get_virtual_area(void *requested_addr, size_t *size,\n \tRTE_LOG(DEBUG, EAL, \"Virtual area found at %p (size = 0x%zx)\\n\",\n \t\taligned_addr, *size);\n \n-\tif (unmap)\n+\tif (unmap) {\n \t\tmunmap(mapped_addr, map_sz);\n+\t} else if (!no_align) {\n+\t\tvoid *map_end, *aligned_end;\n+\t\tsize_t before_len, after_len;\n+\n+\t\t/* when we reserve space with alignment, we add alignment to\n+\t\t * mapping size. On 32-bit, if 1GB alignment was requested, this\n+\t\t * would waste 1GB of address space, which is a luxury we cannot\n+\t\t * afford. so, if alignment was performed, check if any unneeded\n+\t\t * address space can be unmapped back.\n+\t\t */\n+\n+\t\tmap_end = RTE_PTR_ADD(mapped_addr, (size_t)map_sz);\n+\t\taligned_end = RTE_PTR_ADD(aligned_addr, *size);\n+\n+\t\t/* unmap space before aligned mmap address */\n+\t\tbefore_len = RTE_PTR_DIFF(aligned_addr, mapped_addr);\n+\t\tif (before_len > 0)\n+\t\t\tmunmap(mapped_addr, before_len);\n+\n+\t\t/* unmap space after aligned end mmap address */\n+\t\tafter_len = RTE_PTR_DIFF(map_end, aligned_end);\n+\t\tif (after_len > 0)\n+\t\t\tmunmap(aligned_end, after_len);\n+\t}\n \n \tbaseaddr_offset += *size;\n \n", "prefixes": [ "dpdk-dev", "v2", "2/2" ] }{ "id": 39170, "url": "