Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp452578rdg; Tue, 10 Oct 2023 15:48:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGumeRS90vmwwNGZ8dLeh/uOvDBhvZtV4EJQawrzYP25PZhZKS+Fs4l9ocZnlyFGgIpzfDk X-Received: by 2002:a05:6808:144b:b0:3ae:5e0e:1669 with SMTP id x11-20020a056808144b00b003ae5e0e1669mr25162285oiv.42.1696978094263; Tue, 10 Oct 2023 15:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696978094; cv=none; d=google.com; s=arc-20160816; b=c7v37BF1fVAbbwDAqO0xqNgLtnrnYIMoJKQyqRZVJjUK4LQjsPa0Uf8fkUE4iaIkrI ZXTzzT4FQxBVybzHvX8DE2CsF3jHT6qFDQIvgrlMgc9t6T0rd5Kcz9TEBqprtnU7T1CZ 7dNRfjdpegZxzf8pWiKuny51VTMeNHAKqULz1GKOdalN2R7WSHL5kUZfA+5eiXFtsMnJ kBXWPCilDXWuVMeYS87wEAwmu9qB09ZQRRe4Jzc4CFJM/obDM84O+iIGSqETzpIdHhT3 B+YqVlxZHCFQfyDV5fM4btM3wHcZF8GLYpVjHvnNy/uz9Ac+9dKngLBhi3uG0P/TORbg hLVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=7/ZIVn50LkClYO8V7dbxCg5jRS1URuYBZ92bH8lp5jA=; fh=jNRVsY5qvoPWof/pkB3RmMvn3RAEJDYRgose5eShIHM=; b=qCwGHLHLMQezncZOXm6gk57SJkwRngQpUyiJ536JvX+SMTWc339fSXs7Qx3b4XZ22V 1mqNth/oz+Svyid+AYNXMfEqIwTaHV0TI0Gh1EUs8OUML6hSEYdjPRn3WRYOMciQl4cj mZnsIwTNAb2QCfowEc/1TitueOBvYwonFP511XU8qLMjp76W3+g7s0NUkExpv4XUvHV/ zfjDXGp2OqUHDXuNh0O4bR8wx2GrK/XmHOKNQEto0OPwyqhBNb36+iriRgFsHqftThfn PzSUtX9757qGkjJ+xuS8tPlcuTAUFi5qaXdqeSC+zchqaB8igYHXrgnnUcIG60rB3qig v2eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Y20IsFwc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m9-20020a654389000000b0059df1860d60si1199723pgp.424.2023.10.10.15.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:48:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Y20IsFwc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7A8FF808727E; Tue, 10 Oct 2023 15:48:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230363AbjJJWsK (ORCPT + 99 others); Tue, 10 Oct 2023 18:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjJJWsJ (ORCPT ); Tue, 10 Oct 2023 18:48:09 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5629B99; Tue, 10 Oct 2023 15:48:08 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1172) id CA09920B74C0; Tue, 10 Oct 2023 15:48:07 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CA09920B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1696978087; bh=7/ZIVn50LkClYO8V7dbxCg5jRS1URuYBZ92bH8lp5jA=; h=From:To:Cc:Subject:Date:From; b=Y20IsFwc2nBR62fY4pVvhX1kao+yZHmSBJUsKtUFgzbI1EjTU5TsKbTk+bDKUFOP7 7N2Z7IWfLx4y1xsXeX6OC8QUzK53mWZEDck3a3wicf8ejXOi+b2haXMZz/tFpt7KcK GY4N0zv2Mfi5fCtJJ4QFMi+Zuwgh61ZnJcw3WwhA= From: Angelina Vu To: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com Subject: [PATCH] hv_balloon: Add module parameter to configure balloon floor value Date: Tue, 10 Oct 2023 15:48:07 -0700 Message-Id: <1696978087-4421-1-git-send-email-angelinavu@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,SPF_HELO_PASS,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 15:48:13 -0700 (PDT) Currently, the balloon floor value is automatically computed, but may be too small depending on app usage of memory. This patch adds a balloon_floor value as a module parameter that can be used to manually configure the balloon floor value. Signed-off-by: Angelina Vu --- drivers/hv/hv_balloon.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 64ac5bdee3a6..87b312f99b2e 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -1101,6 +1101,10 @@ static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg) } } +unsigned long balloon_floor; +module_param(balloon_floor, ulong, 0644); +MODULE_PARM_DESC(balloon_floor, "Memory level (in megabytes) that ballooning will not remove"); + static unsigned long compute_balloon_floor(void) { unsigned long min_pages; @@ -1117,6 +1121,9 @@ static unsigned long compute_balloon_floor(void) * 8192 744 (1/16) * 32768 1512 (1/32) */ + if (balloon_floor) + return MB2PAGES(balloon_floor); + if (nr_pages < MB2PAGES(128)) min_pages = MB2PAGES(8) + (nr_pages >> 1); else if (nr_pages < MB2PAGES(512)) -- 2.34.1