diff mbox series

[RFC,v1,6/7] powerpc/mm: Clear page access count on allocation

Message ID 20230402104240.1734931-7-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series Support arch-specific page aging mechanism | expand

Commit Message

Aneesh Kumar K.V April 2, 2023, 10:42 a.m. UTC
Clear the HCA access count value on allocation.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/include/asm/page.h |  5 +++++
 arch/powerpc/mm/hca.c           | 13 +++++++++++++
 2 files changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index edf1dd1b0ca9..515423744193 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -319,6 +319,11 @@  void arch_free_page(struct page *page, int order);
 #define HAVE_ARCH_FREE_PAGE
 #endif
 
+#ifdef CONFIG_PPC_HCA_HOTNESS
+void arch_alloc_page(struct page *page, int order);
+#define HAVE_ARCH_ALLOC_PAGE
+#endif
+
 struct vm_area_struct;
 
 extern unsigned long kernstart_virt_addr;
diff --git a/arch/powerpc/mm/hca.c b/arch/powerpc/mm/hca.c
index af6de4492ead..1e79ea89df1b 100644
--- a/arch/powerpc/mm/hca.c
+++ b/arch/powerpc/mm/hca.c
@@ -261,6 +261,19 @@  static void hca_debugfs_init(void)
 	hca_backend_debugfs_init(hca_debugfs_root);
 }
 
+void arch_alloc_page(struct page *page, int order)
+{
+	int i;
+
+	if (!hca_clear_entry)
+		return;
+
+	/* zero the counter value when we allocate the page */
+	for (i = 0; i < (1 << order); i++)
+		hca_clear_entry(page_to_pfn(page + i));
+}
+EXPORT_SYMBOL(arch_alloc_page);
+
 static int __init hca_init(void)
 {
 	if (!hca_backend_debugfs_init) {