get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1528824,
    "url": "http://patchwork.ozlabs.org/api/patches/1528824/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/adcdf302c4758905b0b74787522969aa33a3668e.1631796946.git.lorenzo.bianconi@redhat.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/",
        "name": "Open Virtual Network development",
        "link_name": "ovn",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<adcdf302c4758905b0b74787522969aa33a3668e.1631796946.git.lorenzo.bianconi@redhat.com>",
    "list_archive_url": null,
    "date": "2021-09-16T12:56:55",
    "name": "[ovs-dev] controller: add memory accounting for if_status_mgr module",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "470cad143e1e8bbfd8a8ccfdcbec52b6f0a6cd9f",
    "submitter": {
        "id": 73083,
        "url": "http://patchwork.ozlabs.org/api/people/73083/",
        "name": "Lorenzo Bianconi",
        "email": "lorenzo.bianconi@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/adcdf302c4758905b0b74787522969aa33a3668e.1631796946.git.lorenzo.bianconi@redhat.com/mbox/",
    "series": [
        {
            "id": 262616,
            "url": "http://patchwork.ozlabs.org/api/series/262616/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=262616",
            "date": "2021-09-16T12:56:55",
            "name": "[ovs-dev] controller: add memory accounting for if_status_mgr module",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/262616/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1528824/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1528824/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ovs-dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=LKpW7rYF;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.138; helo=smtp1.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com"
        ],
        "Received": [
            "from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H9HD91Y0Mz9svs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Sep 2021 22:57:12 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id E8E92834FE;\n\tThu, 16 Sep 2021 12:57:09 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n\tby localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id itgcLCqB9p8l; Thu, 16 Sep 2021 12:57:08 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp1.osuosl.org (Postfix) with ESMTPS id 29DF082C1E;\n\tThu, 16 Sep 2021 12:57:07 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id ED892C000F;\n\tThu, 16 Sep 2021 12:57:06 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 81E9EC000D\n for <ovs-dev@openvswitch.org>; Thu, 16 Sep 2021 12:57:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 6328682F32\n for <ovs-dev@openvswitch.org>; Thu, 16 Sep 2021 12:57:05 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 211INmX-SsQ5 for <ovs-dev@openvswitch.org>;\n Thu, 16 Sep 2021 12:57:04 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 72DAD82F76\n for <ovs-dev@openvswitch.org>; Thu, 16 Sep 2021 12:57:04 +0000 (UTC)",
            "from mail-ed1-f71.google.com (mail-ed1-f71.google.com\n [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-577-GeXUpKElMdOzXJQH4kOZhw-1; Thu, 16 Sep 2021 08:56:59 -0400",
            "by mail-ed1-f71.google.com with SMTP id\n r11-20020aa7cfcb000000b003d4fbd652b9so5315522edy.14\n for <ovs-dev@openvswitch.org>; Thu, 16 Sep 2021 05:56:59 -0700 (PDT)",
            "from lore-desk.redhat.com (net-130-25-199-50.cust.vodafonedsl.it.\n [130.25.199.50])\n by smtp.gmail.com with ESMTPSA id dc8sm1390114edb.28.2021.09.16.05.56.57\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 16 Sep 2021 05:56:57 -0700 (PDT)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1631797023;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=u65sOaaXUwFmYFIDJck0+RAmsKAQfoYsln6L1LnDOAM=;\n b=LKpW7rYFfeP2NXkiTXWs4KIwslbGU1BtJAaJEkurlUKEo0i4IPF9ZwWP4q7Lhd8Bo0b2lh\n 4hxppL8OqS0F3aeGN+TVbrGx5l4ZtbbtsJ+a8S1b9lh4TVakY3cUzD7vQjPAEVGm7+at6E\n POzWnKuVNlg4QNtx+30CEGMrVDDFQb0=",
        "X-MC-Unique": "GeXUpKElMdOzXJQH4kOZhw-1",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=u65sOaaXUwFmYFIDJck0+RAmsKAQfoYsln6L1LnDOAM=;\n b=cQvYqC9zCcwxFwffsZJbRM0BwyxB4oNSryTAKc7n03lUuEof22egOVKcbsQ6/hetpV\n M/TgXLPwkPjLn/Dch8US3L7uT9MK+8KJiNxGTFG436lg7JSRqgH0mfFbn4oPNDl0qTpT\n iu3cDff/zdBU0MfCT0v4nnP/R32Y2zH0hVoZbzq9OaJNg5jZaSweswK+dPFlJybxx78j\n PU1XlenCxhj79iCS78FmA4DZvEa8g/zi6hUQ/ZfaNGA3fe78NUCNSIALFna2No7nvZIV\n xsd9o1hK3m08xaDhr1jPKa7KwmqpqB11w2j14fuPmU17bechI7Nq9HiUBjFjS5VVDeKV\n kr3g==",
        "X-Gm-Message-State": "AOAM532aGudhflvrcDzI8wyPTQIgFxQXDg0pvzlNuwT9vJ3fVuA5qfZa\n d7Aw3xtzG9sLv5qLUl98BT7kDYLtkAQ1GG5/bdBgpMqwNwALN7VO6EnZdWpnlfLTjUOy+m6QLJb\n o/bIfd8peflB28/yudc4zaz8g0Tpg5Xy3sQ714UVWCYg70ZNdoajM0FhKPoiQ85cSYMuSeN3vnl\n lXek0H",
        "X-Received": [
            "by 2002:a50:d8c9:: with SMTP id y9mr4548993edj.79.1631797018371;\n Thu, 16 Sep 2021 05:56:58 -0700 (PDT)",
            "by 2002:a50:d8c9:: with SMTP id y9mr4548976edj.79.1631797018129;\n Thu, 16 Sep 2021 05:56:58 -0700 (PDT)"
        ],
        "X-Google-Smtp-Source": "\n ABdhPJwBjvn/z/38twR5kGG3+RV9bhVc7uoIdWu7bW+a5DCLJCwO8RbK39Ae4Kh94KYre/sqd2C3uw==",
        "From": "Lorenzo Bianconi <lorenzo.bianconi@redhat.com>",
        "To": "ovs-dev@openvswitch.org",
        "Date": "Thu, 16 Sep 2021 14:56:55 +0200",
        "Message-Id": "\n <adcdf302c4758905b0b74787522969aa33a3668e.1631796946.git.lorenzo.bianconi@redhat.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Cc": "dceara@redhat.com",
        "Subject": "[ovs-dev] [PATCH ovn] controller: add memory accounting for\n\tif_status_mgr module",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "Introduce memory accounting for data structures in ovn-controller\nif_status_mgr module.\n\nSigned-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>\n---\n controller/if-status.c      | 23 +++++++++++++++++++++++\n controller/if-status.h      |  3 +++\n controller/ovn-controller.c |  1 +\n 3 files changed, 27 insertions(+)",
    "diff": "diff --git a/controller/if-status.c b/controller/if-status.c\nindex 08fb50b87..cd544f9ff 100644\n--- a/controller/if-status.c\n+++ b/controller/if-status.c\n@@ -18,6 +18,7 @@\n #include \"binding.h\"\n #include \"if-status.h\"\n #include \"ofctrl-seqno.h\"\n+#include \"simap.h\"\n \n #include \"lib/hmapx.h\"\n #include \"lib/util.h\"\n@@ -85,6 +86,8 @@ struct ovs_iface {\n                              */\n };\n \n+static uint64_t ifaces_usage;\n+\n /* State machine manager for all local OVS interfaces. */\n struct if_status_mgr {\n     /* All local interfaces, mapping from 'iface-id' to 'struct ovs_iface'. */\n@@ -345,6 +348,8 @@ ovs_iface_create(struct if_status_mgr *mgr, const char *iface_id,\n     iface->id = xstrdup(iface_id);\n     shash_add(&mgr->ifaces, iface_id, iface);\n     ovs_iface_set_state(mgr, iface, state);\n+    ifaces_usage += (strlen(iface_id) + sizeof *iface +\n+                     sizeof(struct shash_node));\n     return iface;\n }\n \n@@ -355,6 +360,8 @@ ovs_iface_destroy(struct if_status_mgr *mgr, struct ovs_iface *iface)\n              if_state_names[iface->state]);\n     hmapx_find_and_delete(&mgr->ifaces_per_state[iface->state], iface);\n     shash_find_and_delete(&mgr->ifaces, iface->id);\n+    ifaces_usage -= (strlen(iface->id) + sizeof *iface +\n+                     sizeof(struct shash_node));\n     free(iface->id);\n     free(iface);\n }\n@@ -413,3 +420,19 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr,\n         local_binding_set_down(bindings, iface->id, sb_readonly, ovs_readonly);\n     }\n }\n+\n+void\n+if_status_mgr_get_memory_usage(struct if_status_mgr *mgr,\n+                               struct simap *usage)\n+{\n+    uint64_t ifaces_state_usage = 0;\n+    for (size_t i = 0; i < ARRAY_SIZE(mgr->ifaces_per_state); i++) {\n+        ifaces_state_usage += sizeof(struct hmapx_node) *\n+                              hmapx_count(&mgr->ifaces_per_state[i]);\n+    }\n+\n+    simap_increase(usage, \"if_status_mgr_ifaces_usage-KB\",\n+                   ROUND_UP(ifaces_usage, 1024) / 1024);\n+    simap_increase(usage, \"if_status_mgr_ifaces_state_usage-KB\",\n+                   ROUND_UP(ifaces_state_usage, 1024) / 1024);\n+}\ndiff --git a/controller/if-status.h b/controller/if-status.h\nindex 51fe7c684..ff4aa760e 100644\n--- a/controller/if-status.h\n+++ b/controller/if-status.h\n@@ -21,6 +21,7 @@\n #include \"binding.h\"\n \n struct if_status_mgr;\n+struct simap;\n \n struct if_status_mgr *if_status_mgr_create(void);\n void if_status_mgr_clear(struct if_status_mgr *);\n@@ -33,5 +34,7 @@ void if_status_mgr_delete_iface(struct if_status_mgr *, const char *iface_id);\n void if_status_mgr_update(struct if_status_mgr *, struct local_binding_data *);\n void if_status_mgr_run(struct if_status_mgr *mgr, struct local_binding_data *,\n                        bool sb_readonly, bool ovs_readonly);\n+void if_status_mgr_get_memory_usage(struct if_status_mgr *mgr,\n+                                    struct simap *usage);\n \n # endif /* controller/if-status.h */\ndiff --git a/controller/ovn-controller.c b/controller/ovn-controller.c\nindex 0031a1035..fabe5e8c0 100644\n--- a/controller/ovn-controller.c\n+++ b/controller/ovn-controller.c\n@@ -3457,6 +3457,7 @@ main(int argc, char *argv[])\n \n             lflow_cache_get_memory_usage(ctrl_engine_ctx.lflow_cache, &usage);\n             ofctrl_get_memory_usage(&usage);\n+            if_status_mgr_get_memory_usage(if_mgr, &usage);\n             memory_report(&usage);\n             simap_destroy(&usage);\n         }\n",
    "prefixes": [
        "ovs-dev"
    ]
}