Skip to contentSkip to conversation

hugetlbfs-extend-hugetlb_vma_lock-to-private-vmas.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Oct 18, 2023 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: hugetlbfs: extend hugetlb_vma_lock to private VMAs
has been removed from the -mm tree. Its filename was
hugetlbfs-extend-hugetlb_vma_lock-to-private-vmas.patch

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

------------------------------------------------------
From: Rik van Riel <[email protected]>
Subject: hugetlbfs: extend hugetlb_vma_lock to private VMAs
Date: Thu, 5 Oct 2023 23:59:07 -0400

Extend the locking scheme used to protect shared hugetlb mappings from truncate vs page fault races, in order to protect private hugetlb mappings (with resv_map) against MADV_DONTNEED.

Add a read-write semaphore to the resv_map data structure, and use that from the hugetlb_vma_(un)lock_* functions, in preparation for closing the race between MADV_DONTNEED and page faults.

Fixes 04ada095dcfc ("hugetlb: don't delete vma_lock in hugetlb MADV_DONTNEED processing")
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Muchun Song <[email protected]>

---

 include/linux/hugetlb.h |    6 +++++
 mm/hugetlb.c            |   41 ++++++++++++++++++++++++++++++++++----
 2 files changed, 43 insertions(+), 4 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~hugetlbfs-extend-hugetlb_vma_lock-to-private-vmas +6 -0
@@ -60,6 +60,7 @@ struct resv_map {
 	long adds_in_progress;
 	struct list_head region_cache;
 	long region_cache_count;
+	struct rw_semaphore rw_sema;
 #ifdef CONFIG_CGROUP_HUGETLB
 	/*
 	 * On private mappings, the counter to uncharge reservations is stored
@@ -1233,6 +1234,11 @@ static inline bool __vma_shareable_lock(
 	return (vma->vm_flags & VM_MAYSHARE) && vma->vm_private_data;
 }
 
+static inline bool __vma_private_lock(struct vm_area_struct *vma)
+{
+	return (!(vma->vm_flags & VM_MAYSHARE)) && vma->vm_private_data;
+}
+
 /*
  * Safe version of huge_pte_offset() to check the locks.  See comments
  * above huge_pte_offset().
mm/hugetlb.c renamed from mm/hugetlb.c~hugetlbfs-extend-hugetlb_vma_lock-to-private-vmas +37 -4

96 lines not on this page · raw message

_

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