From nobody Mon May 6 07:13:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510488419561747.9657072785425; Sun, 12 Nov 2017 04:06:59 -0800 (PST) Received: from localhost ([::1]:48843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDr2C-0000W3-Qw for importer@patchew.org; Sun, 12 Nov 2017 07:06:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDr1H-0000FP-PD for qemu-devel@nongnu.org; Sun, 12 Nov 2017 07:05:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDr1E-0007ra-IS for qemu-devel@nongnu.org; Sun, 12 Nov 2017 07:05:47 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eDr1E-0007qO-BO for qemu-devel@nongnu.org; Sun, 12 Nov 2017 07:05:44 -0500 Received: by mail-wm0-f66.google.com with SMTP id b189so3219095wmd.5 for ; Sun, 12 Nov 2017 04:05:43 -0800 (PST) Received: from fiorina.redhat.com (ip-94-112-73-67.net.upcbroadband.cz. [94.112.73.67]) by smtp.gmail.com with ESMTPSA id f53sm4857230ede.86.2017.11.12.04.05.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Nov 2017 04:05:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZfPbE5356IAm9R+9cLyGwdxS4vyQOVyPAsK3zAVQ7R4=; b=DDcHGh1o9jhFhxhYWY39LM1xsfVzFPUaqI69WAehHRQjHSSHSfBQpMHtSpvHhzNCAu OQt4TUaHA6iqWrzHFIzjM5dCbWNQBaeAinLbcMmwmMr4JVFmywY0MFurEKsagGW2uNwh FBywj8g0mzsPyYOkjOBb6WZbhGqKaImDA9bp2T+naX8p91or26CQTjTooSsECR0to2G2 +t+fVE2FF4UpYicJZmKHUw6lRRa0nSyBANAEkGdsOcg3Jwn8s+sBCKWIiabmYuOGwpi0 AbNJBCFJpXWJw5vp7VaSYY3GHh3TDi1hsqxIJqIXjt7obnO9yI92tH3d6MPfngXDhQ0d lPVg== X-Gm-Message-State: AJaThX6OvwhQAjQFhjNFS6rc2xxrGXqyglQCewph7j+LKJeQg5Neyg+S juhlYq4CPhTw7HUbJ6LM1WlTOg== X-Google-Smtp-Source: AGs4zMZOK7D3iP7TdDq2vNEQyBQHCDTg9jeUNu9sBJQizq+CX6cTS7uEvkiU/2Nx093vHC1vyIlKaA== X-Received: by 10.80.142.132 with SMTP id w4mr8559831edw.251.1510488342444; Sun, 12 Nov 2017 04:05:42 -0800 (PST) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: linux-mm@kvack.org, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Date: Sun, 12 Nov 2017 13:05:38 +0100 Message-Id: <2e8c12f5242bcf755a33ee3a0e9ef94339d1808c.1510487579.git.tgolembi@redhat.com> X-Mailer: git-send-email 2.15.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.66 Subject: [Qemu-devel] [PATCH v3] virtio_balloon: include disk/file caches memory 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: "Michael S. Tsirkin" , Gal Hammer , Jason Wang , Wei Wang , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Shaohua Li , Huang Ying , Amnon Ilan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Add a new field VIRTIO_BALLOON_S_CACHES to virtio_balloon memory statistics protocol. The value represents all disk/file caches. In this case it corresponds to the sum of values Buffers+Cached+SwapCached from /proc/meminfo. Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- drivers/virtio/virtio_balloon.c | 4 ++++ include/uapi/linux/virtio_balloon.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloo= n.c index f0b3a0b9d42f..d2bd13bbaf9f 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -244,11 +244,13 @@ static unsigned int update_balloon_stats(struct virti= o_balloon *vb) struct sysinfo i; unsigned int idx =3D 0; long available; + unsigned long caches; =20 all_vm_events(events); si_meminfo(&i); =20 available =3D si_mem_available(); + caches =3D global_node_page_state(NR_FILE_PAGES); =20 #ifdef CONFIG_VM_EVENT_COUNTERS update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN, @@ -264,6 +266,8 @@ static unsigned int update_balloon_stats(struct virtio_= balloon *vb) pages_to_bytes(i.totalram)); update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL, pages_to_bytes(available)); + update_stat(vb, idx++, VIRTIO_BALLOON_S_CACHES, + pages_to_bytes(caches)); =20 return idx; } diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virti= o_balloon.h index 343d7ddefe04..4e8b8304b793 100644 --- a/include/uapi/linux/virtio_balloon.h +++ b/include/uapi/linux/virtio_balloon.h @@ -52,7 +52,8 @@ struct virtio_balloon_config { #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ #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_NR 7 +#define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */ +#define VIRTIO_BALLOON_S_NR 8 =20 /* * Memory statistics structure. --=20 2.15.0