lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR21MB1688AD7F27C9CA40F7FB4EF1D7D6A@BYAPR21MB1688.namprd21.prod.outlook.com>
Date:   Tue, 17 Oct 2023 17:19:37 +0000
From:   "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
To:     vkuznets <vkuznets@...hat.com>,
        Angelina Vu <angelinavu@...ux.microsoft.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
CC:     KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        Dexuan Cui <decui@...rosoft.com>
Subject: RE: [PATCH] hv_balloon: Add module parameter to configure balloon
 floor value

From: Vitaly Kuznetsov <vkuznets@...hat.com> Sent: Tuesday, October 17, 2023 7:41 AM
> 
> Angelina Vu <angelinavu@...ux.microsoft.com> writes:
> 
> > 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 <angelinavu@...ux.microsoft.com>
> > ---
> >  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))
> 
> 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).
> 
> 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.
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ