linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export
@ 2023-01-09  1:22 Alistair Popple
  2023-01-09 10:13 ` Mike Rapoport
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alistair Popple @ 2023-01-09  1:22 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: John Hubbard, Ralph Campbell, Jérôme Glisse, Ira Weiny,
	Jason Gunthorpe, Christoph Hellwig, Mike Kravetz,
	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.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
---
 include/linux/mmu_notifier.h |  2 --
 mm/mmu_notifier.c            | 10 ----------
 2 files changed, 12 deletions(-)

diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index d6c06e140277..252e44afcc70 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -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;
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index f45ff1b7626a..50c0dde1354f 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -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);
-- 
2.35.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export
  2023-01-09  1:22 [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export Alistair Popple
@ 2023-01-09 10:13 ` Mike Rapoport
  2023-01-09 13:11 ` Jason Gunthorpe
  2023-01-09 19:20 ` Mike Kravetz
  2 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2023-01-09 10:13 UTC (permalink / raw)
  To: Alistair Popple
  Cc: Andrew Morton, linux-mm, John Hubbard, Ralph Campbell,
	Jérôme Glisse, Ira Weiny, Jason Gunthorpe,
	Christoph Hellwig, Mike Kravetz

On Mon, Jan 09, 2023 at 12:22:07PM +1100, Alistair Popple wrote:
> 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.
> 
> Signed-off-by: Alistair Popple <apopple@nvidia.com>

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  include/linux/mmu_notifier.h |  2 --
>  mm/mmu_notifier.c            | 10 ----------
>  2 files changed, 12 deletions(-)
> 
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index d6c06e140277..252e44afcc70 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -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;
> diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
> index f45ff1b7626a..50c0dde1354f 100644
> --- a/mm/mmu_notifier.c
> +++ b/mm/mmu_notifier.c
> @@ -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);
> -- 
> 2.35.1
> 
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export
  2023-01-09  1:22 [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export Alistair Popple
  2023-01-09 10:13 ` Mike Rapoport
@ 2023-01-09 13:11 ` Jason Gunthorpe
  2023-01-09 19:20 ` Mike Kravetz
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2023-01-09 13:11 UTC (permalink / raw)
  To: Alistair Popple
  Cc: Andrew Morton, linux-mm, John Hubbard, Ralph Campbell,
	Jérôme Glisse, Ira Weiny, Christoph Hellwig,
	Mike Kravetz

On Mon, Jan 09, 2023 at 12:22:07PM +1100, Alistair Popple wrote:
> 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.
> 
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> ---
>  include/linux/mmu_notifier.h |  2 --
>  mm/mmu_notifier.c            | 10 ----------
>  2 files changed, 12 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export
  2023-01-09  1:22 [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export Alistair Popple
  2023-01-09 10:13 ` Mike Rapoport
  2023-01-09 13:11 ` Jason Gunthorpe
@ 2023-01-09 19:20 ` Mike Kravetz
  2023-01-10  0:37   ` Alistair Popple
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Kravetz @ 2023-01-09 19:20 UTC (permalink / raw)
  To: Alistair Popple
  Cc: Andrew Morton, linux-mm, John Hubbard, Ralph Campbell,
	Jérôme Glisse, Ira Weiny, Jason Gunthorpe,
	Christoph Hellwig

On 01/09/23 12:22, Alistair Popple wrote:
> 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.
> 
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> ---
>  include/linux/mmu_notifier.h |  2 --
>  mm/mmu_notifier.c            | 10 ----------
>  2 files changed, 12 deletions(-)
> 
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index d6c06e140277..252e44afcc70 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -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;

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

-- 
Mike Kravetz


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export
  2023-01-09 19:20 ` Mike Kravetz
@ 2023-01-10  0:37   ` Alistair Popple
  0 siblings, 0 replies; 5+ messages in thread
From: Alistair Popple @ 2023-01-10  0:37 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: Andrew Morton, linux-mm, John Hubbard, Ralph Campbell,
	Jérôme Glisse, Ira Weiny, Jason Gunthorpe,
	Christoph Hellwig


Mike Kravetz <mike.kravetz@oracle.com> writes:

> On 01/09/23 12:22, Alistair Popple wrote:
>> 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.
>> 
>> Signed-off-by: Alistair Popple <apopple@nvidia.com>
>> ---
>>  include/linux/mmu_notifier.h |  2 --
>>  mm/mmu_notifier.c            | 10 ----------
>>  2 files changed, 12 deletions(-)
>> 
>> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
>> index d6c06e140277..252e44afcc70 100644
>> --- a/include/linux/mmu_notifier.h
>> +++ b/include/linux/mmu_notifier.h
>> @@ -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;
>
> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-10  0:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09  1:22 [PATCH] mm/mmu_notifier: Remove unused mmu_notifier_range_update_to_read_only export Alistair Popple
2023-01-09 10:13 ` Mike Rapoport
2023-01-09 13:11 ` Jason Gunthorpe
2023-01-09 19:20 ` Mike Kravetz
2023-01-10  0:37   ` Alistair Popple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox