Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3305808rdg; Tue, 17 Oct 2023 10:20:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCiA/l2zgmTd1d0LN3Z/HqK4wtwgWaa/3pREei7Zaqc4+d4PGGD0LFFoYSm7vXV19j52z1 X-Received: by 2002:a05:6a00:b8e:b0:6be:59f:5172 with SMTP id g14-20020a056a000b8e00b006be059f5172mr3139900pfj.19.1697563204797; Tue, 17 Oct 2023 10:20:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697563204; cv=pass; d=google.com; s=arc-20160816; b=DUWTOm5x+3AniVarmFGT6sgPzVgoJi7Ba+UuvhWfIBArff71pD0nJP9JRO5H3vK+vd gtm2Y7UH3KWXb/K3rZ8rrh3O4rZ8tk4G/UKdmYpfhV6LZH31LjoL0gwKAYYtjgj13FzN NlTrNvHIZoXyUqKdV4jTEK73sOhqD+4KECwIjp7al+sYXix1zkVGUBnXF7OUep9Bk/1X O+YFDFmTAqO6gO0+atD3WJVQjj3Dq9tci4SXQ/TGQ+SkTDVMNWC3aYS9B3wMj4NZF2hp dty0LEUUoRpWm8+3J4BGcJwKyf9cSILKvYnsh74zmIzO4AbQiyHS0BuqdETPML6J/YCQ dToQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=QDyC6aUdLlBAvPOEX5XG+BQIs8+2oLf+pzhRkxuOmRk=; fh=kvy1mtXD8gjJ/dbAyCqPYPkUxmTaB59vkszGVr+2GZs=; b=p2wlFda0aLHsb7ujDvtaztBIAhKMYUO0ePvPwFJ0NMidzViXcFkKAMsxvyl1rD7d9C uInmsc2sw7P6qEHw0yYwVH0v8rJgCDqDqMak4Lk6y5fVFmrBxssj2Y1UAySxTVGGlKLT HJXjqDzSyH6lP3iTvMHxXKgfqKUDRNjMJ/aVGuyx0hc8dLHNeX85EH5R/ei+Oc33Mf8f OJae3tAy80WCbZMg71pA/jirD2TlhJRacgGte8Qt+aGsqc8Wwpcqmaly5Kj3UIwI2DMd bn+lmng1TZzcqDi6woqm86sJJi/2WIqd7/Ea9oC4rHje4rMrEohpFF52pzxU7jV0PkG5 /w1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=atjvaYgd; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id t30-20020a056a00139e00b00690b88a9c32si2148776pfg.82.2023.10.17.10.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 10:20:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=atjvaYgd; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4D27B801DA94; Tue, 17 Oct 2023 10:19:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343650AbjJQRTq (ORCPT + 99 others); Tue, 17 Oct 2023 13:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbjJQRTp (ORCPT ); Tue, 17 Oct 2023 13:19:45 -0400 Received: from DM6FTOPR00CU001.outbound.protection.outlook.com (mail-centralusazon11020025.outbound.protection.outlook.com [52.101.61.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48338A4; Tue, 17 Oct 2023 10:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VW5/T5vOpnWpOFfiUrmUJ5fa+VY97au//5xg7eAAKCMBz2mm6W6ZxuyWicVInUzZhq6t39MLXV1GsvzwnAGPi48EZ8Yn6h7JPwUTosSVBz41bRVMPSZRrB8RkfKRWaRf8JLmSDAbC4rd8JFcFVKJi6m2ZNMalKuj7l0bxffRcLKKQB4f8eRVhQ3o8TjTg42I1EYXBlk54BTnjrkAlgYssTlDOav3EjDOf5adeX7RQ43tDtaiboOuUxtGCL2DRIBUekO1VZD7eZHK/KRt1Tf0iN2BZ0o3Wxyyef/UlUZLvJY0KInw/2Fye7KEUH7BYuDkMEWogAvivipW4kiIYEUaZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QDyC6aUdLlBAvPOEX5XG+BQIs8+2oLf+pzhRkxuOmRk=; b=ZDHNn7j4TbcZgnbG4h5m4/dB8muUTww3l0hDDC9dEJ5W6UobZgWL3DXyzMKf0Wlr0xVMEjKe5YEyZ+j2meai6lhBVG0hF7DYMiuCtmu89gkj7C5JaLtgq13SEdtTpfEMoQ+xxcxEkKZKENfGcX3zZB+s8uHx+2LFF/erCnMVOK2tVPTq4yZHsmZvt1OTIic9/7+4Bo4EDt5x6ZQxMX0mmoYZg8uXI+CVqgXGgMWH58pnmnYcPokH0glgIT0pRSPP3pFPvGIrPrQcr5Y53rGDjttPWHOvxrS3fxCyZpOpywUEFwuDC+kj0ESbi7obQv/JIokP12x3uxhnauNjNNOWuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QDyC6aUdLlBAvPOEX5XG+BQIs8+2oLf+pzhRkxuOmRk=; b=atjvaYgd8jnkQ6EjYzEdcD4mfWp2Cx8zXYvbA2sZaz4lOXFZt+rfAJ/r9+H59c3P0eDNcRgCyra1ZHH4ZDkkxHHccusjQ9H3He47X9BZEuikOrrU3ZVf0ZbsVi/wIfSlqnU6JONgqIIqZSApat119xPAUlUs7iqYI4Rn91m7Bn0= Received: from BYAPR21MB1688.namprd21.prod.outlook.com (2603:10b6:a02:bf::26) by MN0PR21MB3703.namprd21.prod.outlook.com (2603:10b6:208:3d2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.4; Tue, 17 Oct 2023 17:19:39 +0000 Received: from BYAPR21MB1688.namprd21.prod.outlook.com ([fe80::4592:a0bb:e4ef:3093]) by BYAPR21MB1688.namprd21.prod.outlook.com ([fe80::4592:a0bb:e4ef:3093%5]) with mapi id 15.20.6933.004; Tue, 17 Oct 2023 17:19:38 +0000 From: "Michael Kelley (LINUX)" To: vkuznets , Angelina Vu , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" CC: KY Srinivasan , Haiyang Zhang , "wei.liu@kernel.org" , Dexuan Cui Subject: RE: [PATCH] hv_balloon: Add module parameter to configure balloon floor value Thread-Topic: [PATCH] hv_balloon: Add module parameter to configure balloon floor value Thread-Index: AQHZ+8vbV3zwHLnGYkiL1+0l9vLIfLBOGFyAgAArDVA= Date: Tue, 17 Oct 2023 17:19:37 +0000 Message-ID: References: <1696978087-4421-1-git-send-email-angelinavu@linux.microsoft.com> <87jzrl71me.fsf@redhat.com> In-Reply-To: <87jzrl71me.fsf@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=ce22d28b-a4cf-468a-9fb3-2bbe714810d7;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-10-17T17:15:18Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR21MB1688:EE_|MN0PR21MB3703:EE_ x-ms-office365-filtering-correlation-id: 83cdc12d-a9f4-4cf9-46ce-08dbcf353dc0 x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EdloCRCLs39s6sfvmd0QZgkvcmdndlN0h65ICNtbDQIwzJuo3Gbx2DdwAVzKsRwXpUwhrCX1qdgvw+C5sI+MLyKyiAM8542SZTnESvloaeghz6mKmB+MdwPmKxmaXeWWhphm2dvY3VhxyrxX5ka1m0GamY+RWQ7pIvyk7GRldZTuP4khlopZObGSmA/EM0Sw2/gLWjz1AM/d5lO4NyDxVN63OivGMRNOV8NNZAf1bwOZDqcp+qZJ4YUJRcJ7U0aYQyBA1az/aRA3GJFnNrRvVkehIptOckDw67GsIGHmWRTsGYKisA0g/EzYHy0mVGZFQYNlOLEKMe/Ob6thIjTZDxYFqNraY76r5+cPbsE7iaqPxi+/eNXsuM06gYWBymrs9gvOYdhOHHCrnJwscpRk9oXde4phu8kbcJglsJwxk0CulM24SZY8AuQ9yr8KdhVqNhhWZZOSMhbJ/lAJN5yKp6Z1dsubVJPFjIK8moLDrCOrEiCpwtWmiKLzVHsLL1arkV/7EEEOoe8c6bMHV6Gen8IjPMvJ7S7neJYknv8G5sm2trJlTLFwbGftdaD0D+oGEBHx5c7n+uPP/OwX2/eTSnKzdNumgNsLf0V2cifIaCVWGtoT537wy8sdIyol2QRjq0JAl9VuOpJOs17gcfLpe5HBmpXw62KiIVWZQbpxkbo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR21MB1688.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(396003)(366004)(376002)(39860400002)(230922051799003)(186009)(451199024)(1800799009)(64100799003)(82960400001)(26005)(83380400001)(82950400001)(41300700001)(38070700005)(107886003)(122000001)(33656002)(8990500004)(9686003)(86362001)(38100700002)(1700900015)(2906002)(7696005)(6506007)(71200400001)(10290500003)(55016003)(52536014)(5660300002)(76116006)(64756008)(54906003)(66556008)(110136005)(66946007)(66446008)(66476007)(316002)(8936002)(478600001)(4326008)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-asc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qJPNExAY/EZcX12Fsd?= =?us-ascii?Q?FBI8M40V0foCLtRGSuD/UWZhCzVGFX6FtWbFF2tmTHp/gZTP6Q+jLRhNIfZV?= =?us-ascii?Q?FCMdh6xe8NGieBH3XyTINb1VqzCuu0iCEYZNeXJHA3bWKi8WHoanQW6HLorB?= =?us-ascii?Q?06kJpMsn0ru9VZ0WDC7oirKcreGDsGmuMzAsI3ZNf+AVM+OS8CqvaVErwpY2?= =?us-ascii?Q?HkdNMkjgJHLMtA3Og7askev6zDXOSzQsGUHDlr7pqjAgrFS6+JRTOFzqHKcA?= =?us-ascii?Q?0Av/feVtSjpxBUYYGJVhLhQonsP24bVHdnw3nuqcmStbRXtuYDbP19n3V9mW?= =?us-ascii?Q?butaO9P5M8FFbanM6QLLcVv4bsCJnaI9+2DjlxNqQqPkfygpHD+SHZ3ixb83?= =?us-ascii?Q?ErKBaFJXdC8NvCkDTxNckfkojX6Vl6k5KuvY02qgYsiUSFDVPtmNyBsVteZx?= =?us-ascii?Q?0Mzw1dn2MujEp+fFGDGTbAfp5ewgNrSUVinceSCM8wkVv/VL8NnMjn9GgZ2g?= =?us-ascii?Q?4i/Rx4EwSsiZQKFNDZzrLgLWDY5hBYTvvcldaK/icDqiAIQZN5N3DUay8+lP?= =?us-ascii?Q?n1ytXUpt6fEnuofYMHWNrI8t1P1Y5tH+6jMJ3E5RpTBGu9aZron1Crg0g7QC?= =?us-ascii?Q?NADDF/qSJdv7JvOjzH+NmuchyceefVMYprI64ue55OaHSFynCk01IGHpU23R?= =?us-ascii?Q?FaRFpttAJYBrMxiRLIVFIeJUk7YVJiNxiFi+ho7NEitH+20uR9oQ/ZDdxAS6?= =?us-ascii?Q?0Q=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR21MB1688.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83cdc12d-a9f4-4cf9-46ce-08dbcf353dc0 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Oct 2023 17:19:37.8992 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3eDzd7Ai7monKdyTp3PBW08N05kAJy5NrFAZrpwiopDJ7Tp78styrnAuTpX+sAYG2YJ/Yzn3eBubIBX428a2GFSzbnZrV1vLcg0RTPmMzNY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR21MB3703 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 10:19:53 -0700 (PDT) From: Vitaly Kuznetsov Sent: Tuesday, October 17, 202= 3 7:41 AM >=20 > Angelina Vu writes: >=20 > > Currently, the balloon floor value is automatically computed, but may b= e > > too small depending on app usage of memory. This patch adds a balloon_f= loor > > 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 ball= ooning > 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 =3D MB2PAGES(8) + (nr_pages >> 1); > > else if (nr_pages < MB2PAGES(512)) >=20 > A module parameter is probably useful for debugging but it can hardly be > applied in production environments as it must be 'one size fits all' and > e.g. for different VM sizes it can be different (that's the purpose of > compute_balloon_floor() heuristics). >=20 > In fact, does it has to be statically set? Can we have a sysfs entity so > this can be a policy (userspace decision)? We can keep the current > compute_balloon_floor() as the default but users will be able to adjust > accordingly. >=20 The module parameter can also be set or changed at runtime via /sys/module/balloon/parameters/balloon_floor. Changes made by writing to that path are immediately reflected in the value of the balloon_floor variable. I think that accomplishes everything you've outlined while also allowing a value to be set on the kernel boot line. Michael