From 7e1fba996534984852337ff33cc5cf75dee89cb8 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Sun, 13 Nov 2022 10:34:43 +0000 Subject: [PATCH] ANDROID: memory relinquish: Fix build dependencies Memory relinquish interface is used by both memory ballooning and by page reporting. It must be built if either is specified. Bug: 258944680 Change-Id: I3b949dadbfc4a2b17dba1809a46f0a7386e70ebf Signed-off-by: Keir Fraser --- arch/arm64/include/asm/hypervisor.h | 2 +- arch/arm64/mm/Makefile | 2 +- include/linux/mem_relinquish.h | 6 +++--- mm/Kconfig | 7 +++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/hypervisor.h b/arch/arm64/include/asm/hypervisor.h index aa577913d019..9b4e4ed79623 100644 --- a/arch/arm64/include/asm/hypervisor.h +++ b/arch/arm64/include/asm/hypervisor.h @@ -10,7 +10,7 @@ void kvm_arm_init_hyp_services(void); void kvm_init_memshare_services(void); void kvm_init_ioremap_services(void); -#ifdef CONFIG_MEMORY_BALLOON +#ifdef CONFIG_MEMORY_RELINQUISH void kvm_init_memrelinquish_services(void); #else static inline void kvm_init_memrelinquish_services(void) {} diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile index 55dc9b83b352..d45f88351f9a 100644 --- a/arch/arm64/mm/Makefile +++ b/arch/arm64/mm/Makefile @@ -3,7 +3,7 @@ obj-y := dma-mapping.o extable.o fault.o init.o \ cache.o copypage.o flush.o \ ioremap.o mem_encrypt.o mmap.o pgd.o mmu.o \ context.o proc.o pageattr.o -obj-$(CONFIG_MEMORY_BALLOON) += mem_relinquish.o +obj-$(CONFIG_MEMORY_RELINQUISH) += mem_relinquish.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_PTDUMP_CORE) += ptdump.o obj-$(CONFIG_PTDUMP_DEBUGFS) += ptdump_debugfs.o diff --git a/include/linux/mem_relinquish.h b/include/linux/mem_relinquish.h index 6b7bf861d92d..d3213cb77fc5 100644 --- a/include/linux/mem_relinquish.h +++ b/include/linux/mem_relinquish.h @@ -7,14 +7,14 @@ #ifndef __MEM_RELINQUISH_H__ #define __MEM_RELINQUISH_H__ -#ifdef CONFIG_ARCH_HAS_MEM_RELINQUISH +#ifdef CONFIG_MEMORY_RELINQUISH #include -#else /* !CONFIG_ARCH_HAS_MEM_RELINQUISH */ +#else /* !CONFIG_MEMORY_RELINQUISH */ static inline void page_relinquish(struct page *page) { } -#endif /* CONFIG_ARCH_HAS_MEM_RELINQUISH */ +#endif /* CONFIG_MEMORY_RELINQUISH */ #endif /* __MEM_RELINQUISH_H__ */ diff --git a/mm/Kconfig b/mm/Kconfig index 5bed91aab14e..45adcb74ff62 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -188,6 +188,13 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK config MEMORY_BALLOON bool +# +# support for memory relinquish +config MEMORY_RELINQUISH + def_bool y + depends on ARCH_HAS_MEM_RELINQUISH + depends on MEMORY_BALLOON || PAGE_REPORTING + # # support for memory balloon compaction config BALLOON_COMPACTION