Skip to contentSkip to conversation

mm-rcu-safe-vma-freeing.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 6, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: rcu safe VMA freeing
has been removed from the -mm tree. Its filename was
mm-rcu-safe-vma-freeing.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Michel Lespinasse <[email protected]>
Subject: mm: rcu safe VMA freeing
Date: Mon, 27 Feb 2023 09:36:09 -0800

This prepares for page faults handling under VMA lock, looking up VMAs under protection of an rcu read lock, instead of the usual mmap read lock.

---

 include/linux/mm_types.h |   13 ++++++++++---
 kernel/fork.c            |   20 +++++++++++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-rcu-safe-vma-freeing +10 -3
@@ -480,9 +480,16 @@ struct anon_vma_name {
 struct vm_area_struct {
 	/* The first cache line has the info for VMA tree walking. */
 
-	unsigned long vm_start;		/* Our start address within vm_mm. */
-	unsigned long vm_end;		/* The first byte after our end address
-					   within vm_mm. */
+	union {
+		struct {
+			/* VMA covers [vm_start; vm_end) addresses within mm */
+			unsigned long vm_start;
+			unsigned long vm_end;
+		};
+#ifdef CONFIG_PER_VMA_LOCK
+		struct rcu_head vm_rcu;	/* Used for deferred freeing. */
+#endif
+	};
 
 	struct mm_struct *vm_mm;	/* The address space we belong to. */
 	pgprot_t vm_page_prot;          /* Access permissions of this VMA. */
kernel/fork.c renamed from kernel/fork.c~mm-rcu-safe-vma-freeing +19 -1
@@ -479,12 +479,30 @@ struct vm_area_struct *vm_area_dup(struc
 	return new;
 }
 
-void vm_area_free(struct vm_area_struct *vma)
+static void __vm_area_free(struct vm_area_struct *vma)
 {
 	free_anon_vma_name(vma);
 	kmem_cache_free(vm_area_cachep, vma);
 }
 
+#ifdef CONFIG_PER_VMA_LOCK
+static void vm_area_free_rcu_cb(struct rcu_head *head)
+{
+	struct vm_area_struct *vma = container_of(head, struct vm_area_struct,
+						  vm_rcu);
+	__vm_area_free(vma);
+}
+#endif
+
+void vm_area_free(struct vm_area_struct *vma)
+{
+#ifdef CONFIG_PER_VMA_LOCK
+	call_rcu(&vma->vm_rcu, vm_area_free_rcu_cb);
+#else
+	__vm_area_free(vma);
+#endif
+}
+
 static void account_kernel_stack(struct task_struct *tsk, int account)
 {
 	if (IS_ENABLED(CONFIG_VMAP_STACK)) {

_

Patches currently in -mm which might be from [email protected] are