Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2441851rwb; Fri, 11 Nov 2022 09:19:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf6o84cLpa+aAeiLdlJHyqtB3zedOMwWmcdCHlirFHtZzd6glLQ+dQlZQqrzgFVIacB0cjff X-Received: by 2002:a17:906:154f:b0:78d:9bcf:4d9f with SMTP id c15-20020a170906154f00b0078d9bcf4d9fmr2588759ejd.749.1668187151874; Fri, 11 Nov 2022 09:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668187151; cv=none; d=google.com; s=arc-20160816; b=aHUWlN3DYGCFHDo6B+hW51WRUZNVSZyJbfDsDZwTOpY+w7OWJEQieAO0DifqawL926 z01O1FSstgHZbIgH8KslCRBDkxP7jDalQfOdtQdE+RFKES/xNXVeVpo0lElTcat1wJ9P Mjz9AGucNKHorYIPfopHgvA2je/pcpk3aW4e4Jt+H9J8xOBdXzpiEfPvlm7oRevvd44p PafcLfIHa8PleBg3AR9MUDw8Do4FdZv/XAUBQANsA+g9Jno8LfNNXuLf9LSdX47z5yDl d+0TXMaziB7Glv43speAtclLjrGX4m7kaR3EW8+ouAZmpUMM4LNzuqBp6KIzbdfvCDCm GshQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JOvXDNO49PM7KIqPLjnou7naDaWKpFkuiADPMhOZ5gI=; b=VG2uek1bLRzpeXcOqoe1WHPQ7XegHOpoPtAFPWKk1yB7UVh21vj2wwBXCTE3zRmUtN aikPJX4AfAzoBB7kYdjyTs3S7jYpzh5a5saK2Jxoa1iADS5ZKOJCutaVhD6Wh+5vIlLW l5+4O1cSZl7N3UlcVXMmCogjGY7Id6kaYgrLTF8xbOQvKW4TjxFxC4rjOHOanVT+xT58 oDFFSer9kiBkN9Jf9XHjTqWegFsIJBIfayrGwYUT7+hHAq1DIFPua8vjfF6Rs5OVDHBp FEqd3FwUFchbVx4bP2bE81WnHOWdgEqswOS+LTb7Wa0rs1J949AvIKwMYClLwG7f7RiH tnng== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk35-20020a1709077fa300b0073cd848ae8asi2712436ejc.321.2022.11.11.09.18.48; Fri, 11 Nov 2022 09:19:11 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234063AbiKKQuq (ORCPT + 92 others); Fri, 11 Nov 2022 11:50:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbiKKQuo (ORCPT ); Fri, 11 Nov 2022 11:50:44 -0500 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0322E13E03; Fri, 11 Nov 2022 08:50:44 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso5967362wmb.0; Fri, 11 Nov 2022 08:50:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JOvXDNO49PM7KIqPLjnou7naDaWKpFkuiADPMhOZ5gI=; b=kDSC4GqBrDtOsgRomkNQJ+SLalnAOhceF+lq90ubPtuUZE0yurptGyMK0KKRcz1JU1 M9pVbVedvhNdl5a/nYsBBFu/QJ5GZ2THEZNHEzyLfyD9gvJxGuVmT8+K/IFCrkzZdBuz hDBhZbo+IX7h1LQ64iSd/51Gb1z5qctRQT2HpFyMQ6GMG6A2RY1s450tISqU7dKqiyTX Jp9p0mhDDpEcdzfV3jN3GobmK9bRjudck9WlPJuucfQFUuAVKsOuZE/Fa7gtktG6iV5f YIL1EwrKD6omnGQMnxzJ7nO+EpbO/+WRauJVRtns4tQxvpZHFABTTozuwzFkK9vG76mC toAQ== X-Gm-Message-State: ANoB5pnFq7RI4cE6rkJcdFG2M3PaI0lzGZ/TYTl7DGuVQVGXeS+oNgRC 4PMO7Kja9zmG2R4PgjtDGUA= X-Received: by 2002:a1c:cc01:0:b0:3cf:a9c2:2b04 with SMTP id h1-20020a1ccc01000000b003cfa9c22b04mr1884730wmb.152.1668185442522; Fri, 11 Nov 2022 08:50:42 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id 6-20020a05600c228600b003cf4d99fd2asm3397453wmf.6.2022.11.11.08.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 08:50:42 -0800 (PST) Date: Fri, 11 Nov 2022 16:50:40 +0000 From: Wei Liu To: Shradha Gupta Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Long Li , Michael Kelley Subject: Re: [PATCH] hv_balloon: Fix committed value in post_status() if dynamic memory is disabled Message-ID: References: <1667544770-31377-1-git-send-email-shradhagupta@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1667544770-31377-1-git-send-email-shradhagupta@linux.microsoft.com> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Thu, Nov 03, 2022 at 11:52:50PM -0700, Shradha Gupta wrote: > If Dynamic memory is disabled for VM, the committed value reported by the > post_status() call by hv_balloon driver includes compute_balloon_floor(). > This is not needed if balloon_up operations or hot_add operations were > never requested on the VM(or if Dynamic memory was disabled for the VM) > > Signed-off-by: Shradha Gupta Can you put a Fixes: tag here? You can use git-blame to find out the culprit. Thanks, Wei. > --- > drivers/hv/hv_balloon.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c > index fdf6decacf06..a6f5321d4a2e 100644 > --- a/drivers/hv/hv_balloon.c > +++ b/drivers/hv/hv_balloon.c > @@ -1129,11 +1129,23 @@ static unsigned long compute_balloon_floor(void) > > static unsigned long get_pages_committed(struct hv_dynmem_device *dm) > { > - return vm_memory_committed() + > - dm->num_pages_ballooned + > - (dm->num_pages_added > dm->num_pages_onlined ? > - dm->num_pages_added - dm->num_pages_onlined : 0) + > - compute_balloon_floor(); > + unsigned long pages_committed; > + > + pages_committed = vm_memory_committed(); > + > + /* > + * If no balloon_up or hot_add operation was performed do not add > + * num_pages_ballooned, number of pages offline or > + * compute_balloon_floor() to the pages_committed value > + */ > + if (dm->num_pages_ballooned || dm->num_pages_added) { > + pages_committed += dm->num_pages_ballooned + > + (dm->num_pages_added > dm->num_pages_onlined ? > + dm->num_pages_added - dm->num_pages_onlined : 0) + > + compute_balloon_floor(); > + } > + > + return pages_committed; > } > > /* > -- > 2.37.2 >