Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816773/?format=api
{ "id": 816773, "url": "http://patchwork.ozlabs.org/api/patches/816773/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170921085110.25598-16-aik@ozlabs.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170921085110.25598-16-aik@ozlabs.ru>", "list_archive_url": null, "date": "2017-09-21T08:51:07", "name": "[qemu,v5,15/18] memory: Share special empty FlatView", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c222e5571ada81849d63dee60a8ec7fcaeb83bec", "submitter": { "id": 7621, "url": "http://patchwork.ozlabs.org/api/people/7621/?format=api", "name": "Alexey Kardashevskiy", "email": "aik@ozlabs.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170921085110.25598-16-aik@ozlabs.ru/mbox/", "series": [ { "id": 4333, "url": "http://patchwork.ozlabs.org/api/series/4333/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4333", "date": "2017-09-21T08:50:55", "name": "memory: Store physical root MR in FlatView", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/4333/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816773/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816773/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyVz25fxPz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 19:03:58 +1000 (AEST)", "from localhost ([::1]:52473 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duxOm-0006lu-UZ\n\tfor incoming@patchwork.ozlabs.org; Thu, 21 Sep 2017 05:03:56 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:48549)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1duxCt-00057y-B6\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:43 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1duxCs-0001MO-Ai\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:39 -0400", "from ozlabs.ru ([107.173.13.209]:54112)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1duxCs-0001CA-4C\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:38 -0400", "from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id F13153A60051;\n\tThu, 21 Sep 2017 04:52:53 -0400 (EDT)" ], "From": "Alexey Kardashevskiy <aik@ozlabs.ru>", "To": "qemu-devel@nongnu.org", "Date": "Thu, 21 Sep 2017 18:51:07 +1000", "Message-Id": "<20170921085110.25598-16-aik@ozlabs.ru>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170921085110.25598-1-aik@ozlabs.ru>", "References": "<20170921085110.25598-1-aik@ozlabs.ru>", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [fuzzy]", "X-Received-From": "107.173.13.209", "Subject": "[Qemu-devel] [PATCH qemu v5 15/18] memory: Share special empty\n\tFlatView", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Alexey Kardashevskiy <aik@ozlabs.ru>, Paolo Bonzini <pbonzini@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "This shares an cached empty FlatView among address spaces. The empty\nFV is used every time when a root MR renders into a FV without memory\nsections which happens when MR or its children are not enabled or\nzero-sized. The empty_view is not NULL to keep the rest of memory\nAPI intact; it also has a dispatch tree for the same reason.\n\nOn POWER8 with 255 CPUs, 255 virtio-net, 40 PCI bridges guest this halves\nthe amount of FlatView's in use (557 -> 260) and dispatch tables\n(~800000 -> ~370000), however the total memory footprint is pretty much\nthe same as RCU is holding all these temporary FVs which are created\n(and then released) to make sure that they are empty and can be replaced\nwith @empty_view.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\nChanges:\nv5:\n* generate_memory_topology() now destroys temporary FV directly as\nit is not in use anyway\n* check for mr->enabled and avoid even temporaty FV allocation\n---\n memory.c | 44 +++++++++++++++++++++++++++++++++-----------\n 1 file changed, 33 insertions(+), 11 deletions(-)", "diff": "diff --git a/memory.c b/memory.c\nindex 8ab953ba24..4c28b91890 100644\n--- a/memory.c\n+++ b/memory.c\n@@ -48,6 +48,7 @@ static QTAILQ_HEAD(, AddressSpace) address_spaces\n = QTAILQ_HEAD_INITIALIZER(address_spaces);\n \n static GHashTable *flat_views;\n+static FlatView *empty_view;\n \n typedef struct AddrRange AddrRange;\n \n@@ -746,22 +747,43 @@ static FlatView *generate_memory_topology(MemoryRegion *mr)\n {\n int i;\n FlatView *view;\n+ bool use_empty = false;\n \n- view = flatview_new(mr);\n+ if (!mr->enabled) {\n+ use_empty = true;\n+ } else {\n+ view = flatview_new(mr);\n+ if (mr) {\n+ render_memory_region(view, mr, int128_zero(),\n+ addrrange_make(int128_zero(), int128_2_64()),\n+ false);\n+ }\n+ flatview_simplify(view);\n \n- if (mr) {\n- render_memory_region(view, mr, int128_zero(),\n- addrrange_make(int128_zero(), int128_2_64()), false);\n+ if (!view->nr) {\n+ flatview_destroy(view);\n+ use_empty = true;\n+ }\n }\n- flatview_simplify(view);\n \n- view->dispatch = address_space_dispatch_new(view);\n- for (i = 0; i < view->nr; i++) {\n- MemoryRegionSection mrs =\n- section_from_flat_range(&view->ranges[i], view);\n- flatview_add_to_dispatch(view, &mrs);\n+ if (use_empty) {\n+ if (!empty_view) {\n+ empty_view = flatview_new(NULL);\n+ }\n+ view = empty_view;\n+ flatview_ref(view);\n }\n- address_space_dispatch_compact(view->dispatch);\n+\n+ if (!view->dispatch) {\n+ view->dispatch = address_space_dispatch_new(view);\n+ for (i = 0; i < view->nr; i++) {\n+ MemoryRegionSection mrs =\n+ section_from_flat_range(&view->ranges[i], view);\n+ flatview_add_to_dispatch(view, &mrs);\n+ }\n+ address_space_dispatch_compact(view->dispatch);\n+ }\n+\n g_hash_table_replace(flat_views, mr, view);\n \n return view;\n", "prefixes": [ "qemu", "v5", "15/18" ] }