From patchwork Wed Oct 19 09:56:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Atanasov X-Patchwork-Id: 5338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp287918wrs; Wed, 19 Oct 2022 05:12:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x5DuuM+mG/0BmsWNFdVOyllfEF/Lo2UZphK4krUgGfcbxCkrPWwOeHValTGf3Sg6anjSw X-Received: by 2002:a05:6402:2319:b0:45c:4231:de18 with SMTP id l25-20020a056402231900b0045c4231de18mr7279312eda.383.1666181546976; Wed, 19 Oct 2022 05:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181546; cv=none; d=google.com; s=arc-20160816; b=aa81etuy8euITkmsOyOGMV3DHIf1CqbaqtD3T//9AqCRxHnEcMKXQ56uQUnvLWHGz1 VxOgL/6WUcdqqD82r2Y6twl4CkKUwdBSwnh/P5rp8p7w3qhoM/UKBfsc5WCvskWzvege 7HAeBwII1WHv0wvOa7QCdxxJAWOgvxDuuWeChTYVpbQOdpYjzJGWUzHM58SGYx5XjtYl /IS5TaALB758Y+Ug0vxxVQ2BOBsxNSmv5Y+PuTIQcszVuDfekk6L15CWtUNji3xFqJ0R eAVEZfunD0oPAQQjAYjGg1DNf4xRTQXB3HFiLbwhqm8f0LXBMgaDhV4Jc31uQ1VlsgF4 icFA== 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=k3e79AYNtwHX2CN5cEq6TICYh88ATpzgNJ1qn3tb3v0=; b=htIc4Jw1duF5OtUPfr3eR/+k+T3rIjUu65SHDx64jElgtIHx10VUT32QRdqHDcMd1E 0Q8XwAUJC2ls4w6yh2NkclIIiRNTLVdI6joFjwcneT3MFMmTWFAS1peq5cNcyPi4F7iF eBl0G1EWDwazwGqba0NcLAGqT0GtmTlk43kyVQL8oD9Vfm8dSdtVBUGAAlMAR8c4KlSu 42PGz86NZbvS3ChU5NCfT2WBpkLrZzXz/pP5llH5+z3bV1nlcfjaK5eTtQfoSu/Aer2u 5eyVhXahr3wq1HdqpJeR9p3BnIxZMcyY85/Q18EY/4Z1pLfXP+6r34q9IsWTWoMbe5dH j+GA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka14-20020a170907990e00b0078358970513si12060799ejc.367.2022.10.19.05.11.47; Wed, 19 Oct 2022 05:12:26 -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 S232693AbiJSMKq (ORCPT + 99 others); Wed, 19 Oct 2022 08:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbiJSMJh (ORCPT ); Wed, 19 Oct 2022 08:09:37 -0400 Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4F93C16D; Wed, 19 Oct 2022 04:45:43 -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 1ol5lb-00B8K8-Cj; Wed, 19 Oct 2022 11:56:29 +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: [RFC PATCH v5 3/8] mm: Display inflated memory to users Date: Wed, 19 Oct 2022 12:56:15 +0300 Message-Id: <20221019095620.124909-4-alexander.atanasov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221019095620.124909-1-alexander.atanasov@virtuozzo.com> References: <20221019095620.124909-1-alexander.atanasov@virtuozzo.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117981449446815?= X-GMAIL-MSGID: =?utf-8?q?1747117981449446815?= 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 898c99eae8e4..d88828a27383 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -992,6 +992,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 @@ -1142,6 +1144,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 5101131e6047..d9e059b0b25d 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" @@ -155,6 +158,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);