From patchwork Thu Feb 15 22:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Helman X-Patchwork-Id: 874201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zjBF86qMNz9t3G for ; Fri, 16 Feb 2018 09:45:32 +1100 (AEDT) Received: from localhost ([::1]:39243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emSHT-0004Gb-2f for incoming@patchwork.ozlabs.org; Thu, 15 Feb 2018 17:45:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emSFv-0003Ip-IQ for qemu-devel@nongnu.org; Thu, 15 Feb 2018 17:43:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emSFs-000740-Dm for qemu-devel@nongnu.org; Thu, 15 Feb 2018 17:43:55 -0500 Received: from hqdc-proxy-mwg013-o.oracle.com ([148.87.23.16]:38750 helo=jhdev.us.oracle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emSFs-00073t-6p for qemu-devel@nongnu.org; Thu, 15 Feb 2018 17:43:52 -0500 Received: by jhdev.us.oracle.com (Postfix, from userid 1001) id 09F65404441B5; Thu, 15 Feb 2018 14:06:56 -0800 (PST) From: Jonathan Helman To: qemu-devel@nongnu.org, virtio-dev@lists.oasis-open.org Date: Thu, 15 Feb 2018 14:06:40 -0800 Message-Id: <1518732400-14004-1-git-send-email-jonathan.helman@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 148.87.23.16 Subject: [Qemu-devel] [PATCH] virtio-balloon: add huge page allocation statistics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonathan Helman , mst@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" qemu should read and report huge page allocation statistics exported in the following kernel patch: commit 01be4bb1aafeab73feba628c6dd120cd6647faae Author: Jonathan Helman Date: Thu Feb 15 10:59:03 2018 -0800 virtio_balloon: export huge page allocation statistics Export statistics for successful and failed huge page allocations from the virtio balloon driver. These 2 stats come directly from the vm_events HTLB_BUDDY_PGALLOC and HTLB_BUDDY_PGALLOC_FAIL. Signed-off-by: Jonathan Helman --- docs/virtio-balloon-stats.txt | 2 ++ hw/virtio/virtio-balloon.c | 2 ++ include/standard-headers/linux/virtio_balloon.h | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt index edff5f2..12d33a7 100644 --- a/docs/virtio-balloon-stats.txt +++ b/docs/virtio-balloon-stats.txt @@ -32,6 +32,8 @@ which will return a dictionary containing: - stat-minor-faults - stat-free-memory - stat-total-memory + - stat-htlb-pgalloc + - stat-htlb-pgfail o A key named last-update, which contains the last stats update timestamp in seconds. Since this timestamp is generated by the host, diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 4822449..f4f2b98 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -52,6 +52,8 @@ static const char *balloon_stat_names[] = { [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory", [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory", [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches", + [VIRTIO_BALLOON_S_HTLB_PGALLOC] = "stat-htlb-pgalloc", + [VIRTIO_BALLOON_S_HTLB_PGFAIL] = "stat-htlb-pgfail", [VIRTIO_BALLOON_S_NR] = NULL }; diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h index 7b0a41b..ed445b6 100644 --- a/include/standard-headers/linux/virtio_balloon.h +++ b/include/standard-headers/linux/virtio_balloon.h @@ -53,7 +53,9 @@ struct virtio_balloon_config { #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ #define VIRTIO_BALLOON_S_AVAIL 6 /* Available memory as in /proc */ #define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */ -#define VIRTIO_BALLOON_S_NR 8 +#define VIRTIO_BALLOON_S_HTLB_PGALLOC 8 /* Number of htlb pgalloc successes */ +#define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Number of htlb pgalloc failures */ +#define VIRTIO_BALLOON_S_NR 10 /* * Memory statistics structure.