Skip to contentSkip to conversation

gpu/drm: Use local kmap in drm_clflush_page()

PATCH In review Davidlohr Bueso 1 participant 2 messages Nov 17, 2025 – Dec 8, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/drm: Use local kmap in drm_clflush_page()

Replace the now deprecated kmap_atomic() with kmap_local_page().

Optimize for the non-highmem cases and avoid disabling preemption and pagefaults as clflushopt does not require being CPU locality guarantees and the mapping will hold valid across context switches. Further, highmem is planned to to be removed[1].

[1] https://lore.kernel.org/all/[email protected]/

---
 drivers/gpu/drm/drm_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_cache.c +2 -2
index ea1d2d5d2c66..b6a309f827f8 100644
@@ -57,10 +57,10 @@ drm_clflush_page(struct page *page)
 	if (unlikely(page == NULL))
 		return;
 
-	page_virtual = kmap_atomic(page);
+	page_virtual = kmap_local_page(page);
 	for (i = 0; i < PAGE_SIZE; i += size)
 		clflushopt(page_virtual + i);
-	kunmap_atomic(page_virtual);
+	kunmap_local(page_virtual);
 }
 
 static void drm_cache_flush_clflush(struct page *pages[],
Signature · 1 line
2.39.5
#1 lore raw

ping?

Quoted 33 lines · Davidlohr Bueso

Replace the now deprecated kmap_atomic() with kmap_local_page().

Optimize for the non-highmem cases and avoid disabling preemption and pagefaults as clflushopt does not require being CPU locality guarantees and the mapping will hold valid across context switches. Further, highmem is planned to to be removed[1].

[1] https://lore.kernel.org/all/[email protected]/

---
drivers/gpu/drm/drm_cache.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_cache.c +2 -2
index ea1d2d5d2c66..b6a309f827f8 100644
@@ -57,10 +57,10 @@ drm_clflush_page(struct page *page)
 	if (unlikely(page == NULL))
 		return;
 
-	page_virtual = kmap_atomic(page);
+	page_virtual = kmap_local_page(page);
 	for (i = 0; i < PAGE_SIZE; i += size)
 		clflushopt(page_virtual + i);
-	kunmap_atomic(page_virtual);
+	kunmap_local(page_virtual);
 }
 
 static void drm_cache_flush_clflush(struct page *pages[],
Signature · 1 line
2.39.5