diff mbox series

[v1,09/14] mm: call pgmap->ops->page_free for DEVICE_PUBLIC pages

Message ID 20210825034828.12927-10-alex.sierra@amd.com (mailing list archive)
State New
Headers show
Series Add MEMORY_DEVICE_PUBLIC for CPU-accessible coherent device memory | expand

Commit Message

Sierra Guiza, Alejandro (Alex) Aug. 25, 2021, 3:48 a.m. UTC
Add MEMORY_DEVICE_PUBLIC case to free_zone_device_page callback.
Device public type memory case is now able to free its pages properly.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
---
 mm/memremap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig Aug. 25, 2021, 7:46 a.m. UTC | #1
On Tue, Aug 24, 2021 at 10:48:23PM -0500, Alex Sierra wrote:
> Add MEMORY_DEVICE_PUBLIC case to free_zone_device_page callback.
> Device public type memory case is now able to free its pages properly.

This really should go into patch 4.  And it might make sense to introduce
free_device_private_page directly with the free_device_page name instead
of renaming it a little later.
diff mbox series

Patch

diff --git a/mm/memremap.c b/mm/memremap.c
index 2c8898ed006f..b9a8ed089cc6 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -460,7 +460,7 @@  struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
 EXPORT_SYMBOL_GPL(get_dev_pagemap);
 
 #ifdef CONFIG_DEV_PAGEMAP_OPS
-static void free_device_private_page(struct page *page)
+static void free_device_page(struct page *page)
 {
 
 	__ClearPageWaiters(page);
@@ -494,13 +494,14 @@  static void free_device_private_page(struct page *page)
 void free_zone_device_page(struct page *page)
 {
 	switch (page->pgmap->type) {
+	case MEMORY_DEVICE_PRIVATE:
+	case MEMORY_DEVICE_PUBLIC:
+		free_device_page(page);
+		return;
 	case MEMORY_DEVICE_FS_DAX:
 		/* notify page idle */
 		wake_up_var(&page->_refcount);
 		return;
-	case MEMORY_DEVICE_PRIVATE:
-		free_device_private_page(page);
-		return;
 	default:
 		return;
 	}