Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1613280rwb; Wed, 5 Oct 2022 02:07:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7azfJb875mVZiM9R9By2HWD8qIh2M9V4zw4dOXqBa1JkHMxOopeLMeGExpC6Gxs9I1Lk/L X-Received: by 2002:a17:90b:4b0d:b0:203:690d:9f7f with SMTP id lx13-20020a17090b4b0d00b00203690d9f7fmr3990674pjb.145.1664960830900; Wed, 05 Oct 2022 02:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664960830; cv=none; d=google.com; s=arc-20160816; b=mE/eQ1cE+iyXYlpGHfJ6O8Qb0ltQzYQlSnD3RF+iwGibmvufEdJsKFE1l7oFQMbrST v8Inyst3+I4UrGJarQVwAmdCZEwGNrli70KPaWpKgZJthWUHQ2SwoyT+1/iknmjbhgq7 C0brIz1GyxZIUiImJVylqSYgYbepKtaOwFaTHC0FcoB9kK4iMMv6tYhqoG7FKbdmafIw D29DpPx1R8zEK65Ds76mB5bBFo/a0xtHrRimmAgacV1xJyaxYwCq3cjbeZXsIQ+DaXxy neysviWrvCIgYcm0aYnYeGSkfcKTfcu6Z7viwaXkWjQnHJ7ArJ3bIbKXJtgRUgZmojmk 8zCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DtwMbNq9BJI089BuKoOH0Z2ahWnmPC7B9e7EKGHCeRw=; b=s9X00Tuy8FnXTOowRovgU8b6M6DWRJ/nSRDDm7IZN35OVRyGxhZBR1WyUxSQeV5inG RGUv0YpX9mEUlIEtYspjHV4C10YE7xwX7eC/qkrtYhIl/vfPH1Ey1Qe6jZO42PRbkL8F XOxoiDPkmgHJ5Y4xbSLIfgRyW9UNfwp/90N1F61eROqCIHa24SBtgJfDjWF5zSr5rDKf oSUGaXKgGI2TX89AYlv5sJCAuUXYnvtINCvPp+PX9R8QmixnLI76T0lhNtLnfl6ypcR6 pQIRrrJQMc681bgZSXOc52w3oOVAj0mjjhRqNJ1L+WMYvhLUu0iLwr4gIajMSAoKTTkX vMKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a17090b070900b00202ae67f30asi1173449pjz.163.2022.10.05.02.06.58; Wed, 05 Oct 2022 02:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbiJEJDg (ORCPT + 99 others); Wed, 5 Oct 2022 05:03:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbiJEJDa (ORCPT ); Wed, 5 Oct 2022 05:03:30 -0400 Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A10AE5BC36; Wed, 5 Oct 2022 02:03:29 -0700 (PDT) Received: from dev011.ch-qa.sw.ru ([172.29.1.16]) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1og0GN-007ckN-1e; Wed, 05 Oct 2022 11:02:47 +0200 From: Alexander Atanasov To: Jonathan Corbet Cc: kernel@openvz.org, Alexander Atanasov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 3/7] Display inflated memory to users Date: Wed, 5 Oct 2022 12:01:53 +0300 Message-Id: <20221005090158.2801592-4-alexander.atanasov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221005090158.2801592-1-alexander.atanasov@virtuozzo.com> References: <20221005090158.2801592-1-alexander.atanasov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add InflatedTotal and InflatedFree to /proc/meminfo Signed-off-by: Alexander Atanasov --- Documentation/filesystems/proc.rst | 6 ++++++ fs/proc/meminfo.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index e7aafc82be99..690e1b90ffee 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -991,6 +991,8 @@ Example output. You may not have all of these fields. VmallocUsed: 40444 kB VmallocChunk: 0 kB Percpu: 29312 kB + InflatedTotal: 2097152 kB + InflatedFree: 0 kB HardwareCorrupted: 0 kB AnonHugePages: 4149248 kB ShmemHugePages: 0 kB @@ -1138,6 +1140,10 @@ VmallocChunk Percpu Memory allocated to the percpu allocator used to back percpu allocations. This stat excludes the cost of metadata. +InflatedTotal and InflatedFree + Amount of memory that is inflated by the balloon driver. + Due to differences among the drivers inflated memory + is subtracted from TotalRam or from MemFree. HardwareCorrupted The amount of RAM/memory in KB, the kernel identifies as corrupted. diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 6e89f0e2fd20..7182886efdbf 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -16,6 +16,9 @@ #ifdef CONFIG_CMA #include #endif +#ifdef CONFIG_MEMORY_BALLOON +#include +#endif #include #include "internal.h" @@ -153,6 +156,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v) global_zone_page_state(NR_FREE_CMA_PAGES)); #endif +#ifdef CONFIG_MEMORY_BALLOON + seq_printf(m, "InflatedTotal: %8ld kB\n", + atomic_long_read(&mem_balloon_inflated_total_kb)); + seq_printf(m, "InflatedFree: %8ld kB\n", + atomic_long_read(&mem_balloon_inflated_free_kb)); +#endif + hugetlb_report_meminfo(m); arch_report_meminfo(m); -- 2.31.1