Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp914523rwi; Wed, 19 Oct 2022 04:42:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+RsAmMc7rTJZdETkMvnN02+7+1oo7BEAqYbdALj4HequhwnfROCU/FTV4G/Fp1P2FWtyk X-Received: by 2002:a63:250:0:b0:43c:1f18:a471 with SMTP id 77-20020a630250000000b0043c1f18a471mr6948850pgc.373.1666179719825; Wed, 19 Oct 2022 04:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179719; cv=none; d=google.com; s=arc-20160816; b=GdVCKDEQ1V8Johenbf4CiUeKC2jPJpRyLF+lmy9nUEXiwtX4Ulrfbsf5gH5C8Ne8rB Ypb/IxHF19/ir0y9XTS4YUcpN4asP9k4jZ9R5wSHfKmgm6JeeXPYHkz7zK9F4yj/6Su2 ZfO27z9TKMMAY+71vb2LGjH8VtPN4qhv3jCyGpCvNPYn6LRB2d9cgHjptdOO1A6VvogW ia/qMff7u+jgvL+TJ6oKrn4lLEFyFcYJdpgQ3CTf3deZNJgCQHqU4vp5aWfJig18XiZA uJ1Hq+8BFOnWv4qZLt6EobU13H4fW+g955ZLfZ1lvBHdnvzgq7QxL3uWVA9De9J2Ws5B qmSQ== 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=671V1lffgi4VLoXvZlNBB4JMadlneTt/JPeRz1fJQeM=; b=Wt+VWm87ObdSQZhYj9P4vz44Ozu84AVKocPDO2gTVWsF95p0D+DQO0E156sTxOqfL0 aBxn6GSGTvdsNvCyrNGEIVuLADuRFvm34S5EsvCmblaZP+U6Jl1xzupgXmD/maTGLcav ojHjjILfcRrnS/Hd0HeZTU6lvsAAhOnkTs6Sp3wyC8K+8z4jr7QeiDVMYvzCJx88Pnzb XB3AJlOJwu0q5Jo8Ec66CoLRwt+oi3D+AzbxmEI8bO4N/OJ6+xBDlf7Kjl7fqnyHOZdu x8N2lwsfKl9NYZRVAjELIMbKgdMx6++vvlXqtqk3a94OTSd++01a2pw4VnZ2hRCOWsmr I68w== 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 r73-20020a632b4c000000b0045f0795c39esi18521756pgr.578.2022.10.19.04.41.47; Wed, 19 Oct 2022 04:41:59 -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 S229525AbiJSLaN (ORCPT + 99 others); Wed, 19 Oct 2022 07:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbiJSL3n (ORCPT ); Wed, 19 Oct 2022 07:29:43 -0400 Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC789170DDC; Wed, 19 Oct 2022 04:03:45 -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 1ol5lg-00B8K8-NM; Wed, 19 Oct 2022 11:56:35 +0200 From: Alexander Atanasov To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui Cc: kernel@openvz.org, Alexander Atanasov , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v5 7/8] drivers: hyperv: balloon - report inflated memory Date: Wed, 19 Oct 2022 12:56:19 +0300 Message-Id: <20221019095620.124909-8-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 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 Update the inflated memory in the mm core on change. Signed-off-by: Alexander Atanasov --- drivers/hv/hv_balloon.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index fdf6decacf06..280622ee0e9b 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1280,6 +1281,14 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, return i * alloc_unit; } +static void report_ballooned_pages(struct hv_dynmem_device *dm) +{ + u32 actual = dm->num_pages_ballooned; + long inflated_kb = actual << (HV_HYP_PAGE_SHIFT - 10); + + balloon_set_inflated_total(inflated_kb); +} + static void balloon_up(struct work_struct *dummy) { unsigned int num_pages = dm_device.balloon_wrk.num_pages; @@ -1368,6 +1377,7 @@ static void balloon_up(struct work_struct *dummy) } } + report_ballooned_pages(&dm_device); } static void balloon_down(struct hv_dynmem_device *dm, @@ -1387,6 +1397,8 @@ static void balloon_down(struct hv_dynmem_device *dm, pr_debug("Freed %u ballooned pages.\n", prev_pages_ballooned - dm->num_pages_ballooned); + report_ballooned_pages(dm); + if (req->more_pages == 1) return; -- 2.31.1