Thread (25 messages) 25 messages, 6 authors, 2024-08-12

Re: [PATCH 1/4] mm: Add optional close() to struct vm_special_mapping

From: David Hildenbrand <hidden>
Date: 2024-08-07 15:32:18
Also in: lkml

On 07.08.24 14:41, Michael Ellerman wrote:
quoted hunk ↗ jump to hunk
Add an optional close() callback to struct vm_special_mapping. It will
be used, by powerpc at least, to handle unmapping of the VDSO.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
  include/linux/mm_types.h | 2 ++
  mm/mmap.c                | 3 +++
  2 files changed, 5 insertions(+)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 485424979254..ef32d87a3adc 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -1313,6 +1313,8 @@ struct vm_special_mapping {
  
  	int (*mremap)(const struct vm_special_mapping *sm,
  		     struct vm_area_struct *new_vma);
+	void (*close)(const struct vm_special_mapping *sm,
+		      struct vm_area_struct *vma);
  };
  
  enum tlb_flush_reason {
diff --git a/mm/mmap.c b/mm/mmap.c
index d0dfc85b209b..24bd6aa9155c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3624,6 +3624,9 @@ static vm_fault_t special_mapping_fault(struct vm_fault *vmf);
   */
  static void special_mapping_close(struct vm_area_struct *vma)
  {
+	const struct vm_special_mapping *sm = vma->vm_private_data;
I'm old-fashioned, I enjoy an empty line here ;)
+	if (sm->close)
+		sm->close(sm, vma);
Reviewed-by: David Hildenbrand <redacted>

-- 
Cheers,

David / dhildenb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help