get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 816850,
    "url": "http://patchwork.ozlabs.org/api/patches/816850/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/b13f11c03ed394bd8ad367dc90996ed134ea98da.1505998455.git.tgolembi@redhat.com/",
    "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": "<b13f11c03ed394bd8ad367dc90996ed134ea98da.1505998455.git.tgolembi@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-21T12:55:41",
    "name": "[v2,1/1] virtio_balloon: include buffers and cached memory statistics",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d975f2cf94edb2330376184b266549efb483c877",
    "submitter": {
        "id": 69377,
        "url": "http://patchwork.ozlabs.org/api/people/69377/?format=api",
        "name": "Tomáš Golembiovský",
        "email": "tgolembi@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/b13f11c03ed394bd8ad367dc90996ed134ea98da.1505998455.git.tgolembi@redhat.com/mbox/",
    "series": [
        {
            "id": 4378,
            "url": "http://patchwork.ozlabs.org/api/series/4378/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4378",
            "date": "2017-09-21T12:55:40",
            "name": "linux: Buffers/caches in VirtIO Balloon driver stats",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/4378/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/816850/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/816850/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 3xyc7V5PFvz9t43\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 22:56:38 +1000 (AEST)",
            "from localhost ([::1]:53549 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 1dv11w-0005Sd-RX\n\tfor incoming@patchwork.ozlabs.org; Thu, 21 Sep 2017 08:56:36 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:50100)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <tgolembi@redhat.com>) id 1dv11E-0005Pf-O0\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 08:55:53 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <tgolembi@redhat.com>) id 1dv119-00076J-TV\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 08:55:52 -0400",
            "from mail-wr0-f175.google.com ([209.85.128.175]:54109)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <tgolembi@redhat.com>) id 1dv119-00075h-LX\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 08:55:47 -0400",
            "by mail-wr0-f175.google.com with SMTP id l22so4542083wrc.10\n\tfor <qemu-devel@nongnu.org>; Thu, 21 Sep 2017 05:55:47 -0700 (PDT)",
            "from fiorina.brq.redhat.com (nat-pool-brq-t.redhat.com.\n\t[213.175.37.10]) by smtp.gmail.com with ESMTPSA id\n\te77sm3382129wmf.27.2017.09.21.05.55.44\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 21 Sep 2017 05:55:45 -0700 (PDT)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=QQqrEZhzMM/+LPQeNrEAB3OmSWcWViwH5vxzDcJ1SMQ=;\n\tb=AHiBc7pTOontQVTknfWPtuhuUTkHebs3Lz2efALQCXN59d53G+ZOMqUhM+6Ik4x4rP\n\tCI9cFQBLZZH6oCcXddgj5PNG0hreqWDSq2iCCZJjaIxDsEA3TLMXqdy55/HybTpSLcmX\n\ttKsoJQFjsPIC/HCXkX/4LIpvVSV7jlV93JQADVnoMhlLj917anVHRTtWnE5qgEFJvx++\n\tJ73AmP6C1oiElgNhLhirFwb5B/TJ26PqneReTZw5j1mFnkToXwpHb8fZJtsCeIcIu6F1\n\tdoSQ9pR7iczUKpj5vccodHrlVIFqftbXDBRwrAD/7H71FqvHyKO6Wvrp5B5Gg75SCaN+\n\tos+A==",
        "X-Gm-Message-State": "AHPjjUjUdDQbBVKw4CCIz0qDxPRn6nD/uyxOn3On+HF4XHujQaabn/cN\n\tX2Yd6OoANkNCwhUMPYRfxYqGEQ==",
        "X-Google-Smtp-Source": "AOwi7QDZbgQWdW/t/4R/pgDGFJ4rMVWCpC5nu6dvTB9eRoNG0jzD5YiG9r0TrFm/1txlhNOWJ75I1w==",
        "X-Received": "by 10.223.146.129 with SMTP id 1mr1968703wrn.1.1505998546442;\n\tThu, 21 Sep 2017 05:55:46 -0700 (PDT)",
        "From": "=?utf-8?b?VG9tw6HFoSBHb2xlbWJpb3Zza8O9?= <tgolembi@redhat.com>",
        "To": "linux-mm@kvack.org, virtualization@lists.linux-foundation.org,\n\tqemu-devel@nongnu.org, kvm@vger.kernel.org,\n\tvirtio-dev@lists.oasis-open.org",
        "Date": "Thu, 21 Sep 2017 14:55:41 +0200",
        "Message-Id": "<b13f11c03ed394bd8ad367dc90996ed134ea98da.1505998455.git.tgolembi@redhat.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<cover.1505998455.git.tgolembi@redhat.com>",
        "References": "<cover.1505998455.git.tgolembi@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.85.128.175",
        "Subject": "[Qemu-devel] [PATCH v2 1/1] virtio_balloon: include buffers and\n\tcached memory statistics",
        "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": "\"Michael S. Tsirkin\" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, \n\tWei Wang <wei.w.wang@intel.com>, =?utf-8?b?VG9tw6HFoSBHb2xlbWJpb3Zz?=\n\t=?utf-8?b?a8O9?= <tgolembi@redhat.com>, Shaohua Li <shli@fb.com>,\n\tHuang Ying <ying.huang@intel.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": "Add a new fields, VIRTIO_BALLOON_S_BUFFERS and VIRTIO_BALLOON_S_CACHED,\nto virtio_balloon memory statistics protocol. The values correspond to\n'Buffers' and 'Cached' in /proc/meminfo.\n\nTo be able to compute the value of 'Cached' memory it is necessary to\nexport total_swapcache_pages() to modules.\n\nSigned-off-by: Tomáš Golembiovský <tgolembi@redhat.com>\n---\n drivers/virtio/virtio_balloon.c     | 11 +++++++++++\n include/uapi/linux/virtio_balloon.h |  4 +++-\n mm/swap_state.c                     |  1 +\n 3 files changed, 15 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c\nindex f0b3a0b9d42f..c2558ec47a62 100644\n--- a/drivers/virtio/virtio_balloon.c\n+++ b/drivers/virtio/virtio_balloon.c\n@@ -244,12 +244,19 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb)\n \tstruct sysinfo i;\n \tunsigned int idx = 0;\n \tlong available;\n+\tlong cached;\n \n \tall_vm_events(events);\n \tsi_meminfo(&i);\n \n \tavailable = si_mem_available();\n \n+\tcached = global_node_page_state(NR_FILE_PAGES) -\n+\t\t\ttotal_swapcache_pages() - i.bufferram;\n+\tif (cached < 0)\n+\t\tcached = 0;\n+\n+\n #ifdef CONFIG_VM_EVENT_COUNTERS\n \tupdate_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,\n \t\t\t\tpages_to_bytes(events[PSWPIN]));\n@@ -264,6 +271,10 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb)\n \t\t\t\tpages_to_bytes(i.totalram));\n \tupdate_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL,\n \t\t\t\tpages_to_bytes(available));\n+\tupdate_stat(vb, idx++, VIRTIO_BALLOON_S_BUFFERS,\n+\t\t\t\tpages_to_bytes(i.bufferram));\n+\tupdate_stat(vb, idx++, VIRTIO_BALLOON_S_CACHED,\n+\t\t\t\tpages_to_bytes(cached));\n \n \treturn idx;\n }\ndiff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h\nindex 343d7ddefe04..d5dc8a56a497 100644\n--- a/include/uapi/linux/virtio_balloon.h\n+++ b/include/uapi/linux/virtio_balloon.h\n@@ -52,7 +52,9 @@ struct virtio_balloon_config {\n #define VIRTIO_BALLOON_S_MEMFREE  4   /* Total amount of free memory */\n #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */\n #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */\n-#define VIRTIO_BALLOON_S_NR       7\n+#define VIRTIO_BALLOON_S_BUFFERS  7   /* Buffers memory as in /proc */\n+#define VIRTIO_BALLOON_S_CACHED   8   /* Cached memory as in /proc */\n+#define VIRTIO_BALLOON_S_NR       9\n \n /*\n  * Memory statistics structure.\ndiff --git a/mm/swap_state.c b/mm/swap_state.c\nindex 71ce2d1ccbf7..f3a4ff7d6c52 100644\n--- a/mm/swap_state.c\n+++ b/mm/swap_state.c\n@@ -95,6 +95,7 @@ unsigned long total_swapcache_pages(void)\n \trcu_read_unlock();\n \treturn ret;\n }\n+EXPORT_SYMBOL_GPL(total_swapcache_pages);\n \n static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);\n \n",
    "prefixes": [
        "v2",
        "1/1"
    ]
}