Skip to contentSkip to conversation

mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export

PATCH Superseded Alistair Popple 4 participants 5 messages Jan 9, 2023 – Jan 10, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export

mmu_notifier_range_update_to_read_only() was originally introduced in commit c6d23413f81b ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for device drivers that know a range has only been mapped read-only. However there are no users of this feature so remove it. As it is the only user of the struct mmu_notifier_range.vma field remove that also.

---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)
include/linux/mmu_notifier.h +0 -2
index d6c06e140277..252e44afcc70 100644
@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map;
 #endif
 
 struct mmu_notifier_range {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm;
 	unsigned long start;
 	unsigned long end;
@@ -519,7 +518,6 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
 					   unsigned long start,
 					   unsigned long end)
 {
-	range->vma = vma;
 	range->event = event;
 	range->mm = mm;
 	range->start = start;
mm/mmu_notifier.c +0 -10
index f45ff1b7626a..50c0dde1354f 100644
@@ -1120,13 +1120,3 @@ void mmu_notifier_synchronize(void)
 	synchronize_srcu(&srcu);
 }
 EXPORT_SYMBOL_GPL(mmu_notifier_synchronize);
-
-bool
-mmu_notifier_range_update_to_read_only(const struct mmu_notifier_range *range)
-{
-	if (!range->vma || range->event != MMU_NOTIFY_PROTECTION_VMA)
-		return false;
-	/* Return true if the vma still have the read flag set. */
-	return range->vma->vm_flags & VM_READ;
-}
-EXPORT_SYMBOL_GPL(mmu_notifier_range_update_to_read_only);
Signature · 1 line
2.35.1
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alistair Popple

mmu_notifier_range_update_to_read_only() was originally introduced in commit c6d23413f81b ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for device drivers that know a range has only been mapped read-only. However there are no users of this feature so remove it. As it is the only user of the struct mmu_notifier_range.vma field remove that also.

Quoted 47 lines
---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)
include/linux/mmu_notifier.h +0 -2
index d6c06e140277..252e44afcc70 100644
@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map;
 #endif
 
 struct mmu_notifier_range {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm;
 	unsigned long start;
 	unsigned long end;
@@ -519,7 +518,6 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
 					   unsigned long start,
 					   unsigned long end)
 {
-	range->vma = vma;
 	range->event = event;
 	range->mm = mm;
 	range->start = start;
mm/mmu_notifier.c +0 -10
index f45ff1b7626a..50c0dde1354f 100644
@@ -1120,13 +1120,3 @@ void mmu_notifier_synchronize(void)
 	synchronize_srcu(&srcu);
 }
 EXPORT_SYMBOL_GPL(mmu_notifier_synchronize);
-
-bool
-mmu_notifier_range_update_to_read_only(const struct mmu_notifier_range *range)
-{
-	if (!range->vma || range->event != MMU_NOTIFY_PROTECTION_VMA)
-		return false;
-	/* Return true if the vma still have the read flag set. */
-	return range->vma->vm_flags & VM_READ;
-}
-EXPORT_SYMBOL_GPL(mmu_notifier_range_update_to_read_only);
Signature · 1 line
2.35.1
Signature · 2 lines
Sincerely yours,
Mike.
Reviewed-by on v1 1/1
#2 lore raw
In reply to Alistair Popple
Quoted 8 lines · Alistair Popple

mmu_notifier_range_update_to_read_only() was originally introduced in commit c6d23413f81b ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for device drivers that know a range has only been mapped read-only. However there are no users of this feature so remove it. As it is the only user of the struct mmu_notifier_range.vma field remove that also.

Quoted 5 lines
---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)

Jason

#3 lore raw
In reply to Alistair Popple
Quoted 27 lines · Alistair Popple

mmu_notifier_range_update_to_read_only() was originally introduced in commit c6d23413f81b ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for device drivers that know a range has only been mapped read-only. However there are no users of this feature so remove it. As it is the only user of the struct mmu_notifier_range.vma field remove that also.

---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)
include/linux/mmu_notifier.h +0 -1
index d6c06e140277..252e44afcc70 100644
@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map;
 #endif
 
 struct mmu_notifier_range {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm;
 	unsigned long start;
 	unsigned long end;

include/linux/mmu_notifier.h static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, · line 522

Quoted 4 lines
include/linux/mmu_notifier.h +0 -1
@@ -519,7 +518,6 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
 					   unsigned long start,
 					   unsigned long end)
 {
-	range->vma = vma;

Any reason why you did not delete the vma argument to mmu_notifier_range_init?

Signature · 1 line
Mike Kravetz
#4 lore raw
Quoted 22 lines · Mike Kravetz
Quoted 21 lines · Alistair Popple

mmu_notifier_range_update_to_read_only() was originally introduced in commit c6d23413f81b ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for device drivers that know a range has only been mapped read-only. However there are no users of this feature so remove it. As it is the only user of the struct mmu_notifier_range.vma field remove that also.

---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)
include/linux/mmu_notifier.h +0 -0
index d6c06e140277..252e44afcc70 100644
@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map;
 #endif
 
Quoted 12 lines

include/linux/mmu_notifier.h static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, · line 522

Quoted 10 lines
include/linux/mmu_notifier.h +0 -2
 struct mmu_notifier_range {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm;
 	unsigned long start;
 	unsigned long end;
@@ -519,7 +518,6 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
 					   unsigned long start,
 					   unsigned long end)
 {
-	range->vma = vma;

Any reason why you did not delete the vma argument to mmu_notifier_range_init?

Argh, because I wrote this as a quick test before the break and totally forgot that is why I didn't send it before going on leave. Thanks for noticing, will send a v2.

- Alistair