From: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx> Sent: Tuesday, March 23, 2021 11:47 AM > > Linux has support for free page reporting now (36e66c554b5c) for > virtualized environment. On Hyper-V when virtually backed VMs are > configured, Hyper-V will advertise cold memory discard capability, > when supported. This patch adds the support to hook into the free > page reporting infrastructure and leverage the Hyper-V cold memory > discard hint hypercall to report/free these pages back to the host. > > Signed-off-by: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx> > Tested-by: Matheus Castello <matheus@xxxxxxxxxxxxxxx> > --- > In V2: > - Addressed feedback comments > - Added page reporting config option tied to hyper-v balloon config > > In V3: > - Addressed feedback from Vitaly > > In V4: > - Queried and cached the Hyper-V extended capability for the lifetime > of the VM > - Addressed feedback from Michael Kelley. > > In v5: > - Added a comment clarifying handling of failed query extended > capability hypercall to address Michael's feedback. > --- > arch/x86/hyperv/hv_init.c | 51 +++++++++++++++++- > arch/x86/kernel/cpu/mshyperv.c | 9 ++-- > drivers/hv/Kconfig | 1 + > drivers/hv/hv_balloon.c | 89 +++++++++++++++++++++++++++++++ > include/asm-generic/hyperv-tlfs.h | 35 +++++++++++- > include/asm-generic/mshyperv.h | 3 +- > 6 files changed, 180 insertions(+), 8 deletions(-) > Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>