linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte()
@ 2020-04-19  3:30 qiwuchen55
  2020-04-19  3:30 ` [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range() qiwuchen55
  2020-04-19 10:26 ` [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() Matthew Wilcox
  0 siblings, 2 replies; 5+ messages in thread
From: qiwuchen55 @ 2020-04-19  3:30 UTC (permalink / raw)
  To: akpm, mhocko, willy; +Cc: linux-mm, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

As discussed in patch[1], special mapping ptes such as device
mapping ptes don't need to operate on their corresponding pages,
so the redundant pte_devmap case can be removed.

[1] https://patchwork.kernel.org/patch/11494691/

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 mm/memory.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index f703fe8..2143827 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -802,8 +802,6 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
 		get_page(page);
 		page_dup_rmap(page, false);
 		rss[mm_counter(page)]++;
-	} else if (pte_devmap(pte)) {
-		page = pte_page(pte);
 	}
 
 out_set_pte:
-- 
1.9.1



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

* [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range()
  2020-04-19  3:30 [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() qiwuchen55
@ 2020-04-19  3:30 ` qiwuchen55
  2020-04-19 10:30   ` Matthew Wilcox
  2020-04-19 10:26 ` [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() Matthew Wilcox
  1 sibling, 1 reply; 5+ messages in thread
From: qiwuchen55 @ 2020-04-19  3:30 UTC (permalink / raw)
  To: akpm, mhocko, willy; +Cc: linux-mm, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

As discussed in patch[1], there is an imbalnace of normal
page refcount between copy_one_pte() and zap_pte_range().
This patch put the refcount of normal page back in
zap_pte_range() to fix the imbalance.

[1] https://patchwork.kernel.org/patch/11494691/

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 mm/memory.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/memory.c b/mm/memory.c
index 2143827..ec8de9a 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1088,6 +1088,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
 			}
 			rss[mm_counter(page)]--;
 			page_remove_rmap(page, false);
+			put_page(page);
 			if (unlikely(page_mapcount(page) < 0))
 				print_bad_pte(vma, addr, ptent, page);
 			if (unlikely(__tlb_remove_page(tlb, page))) {
-- 
1.9.1



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

* Re: [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte()
  2020-04-19  3:30 [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() qiwuchen55
  2020-04-19  3:30 ` [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range() qiwuchen55
@ 2020-04-19 10:26 ` Matthew Wilcox
  2020-04-20  7:54   ` Michal Hocko
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2020-04-19 10:26 UTC (permalink / raw)
  To: qiwuchen55; +Cc: akpm, mhocko, linux-mm, chenqiwu

On Sun, Apr 19, 2020 at 11:30:16AM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> As discussed in patch[1], special mapping ptes such as device
> mapping ptes don't need to operate on their corresponding pages,
> so the redundant pte_devmap case can be removed.
> 
> [1] https://patchwork.kernel.org/patch/11494691/

This is a terrible changelog.  What it should say is something like:

Since commit 25b2995a35b6 ("mm: remove MEMORY_DEVICE_PUBLIC support"),
the assignment to 'page' has been unnecessary.  Remove it.

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> ---
>  mm/memory.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index f703fe8..2143827 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -802,8 +802,6 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
>  		get_page(page);
>  		page_dup_rmap(page, false);
>  		rss[mm_counter(page)]++;
> -	} else if (pte_devmap(pte)) {
> -		page = pte_page(pte);
>  	}
>  
>  out_set_pte:
> -- 
> 1.9.1
> 
> 


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

* Re: [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range()
  2020-04-19  3:30 ` [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range() qiwuchen55
@ 2020-04-19 10:30   ` Matthew Wilcox
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2020-04-19 10:30 UTC (permalink / raw)
  To: qiwuchen55; +Cc: akpm, mhocko, linux-mm, chenqiwu

On Sun, Apr 19, 2020 at 11:30:17AM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> As discussed in patch[1], there is an imbalnace of normal
> page refcount between copy_one_pte() and zap_pte_range().
> This patch put the refcount of normal page back in
> zap_pte_range() to fix the imbalance.

I think you misunderstood the discussion.  NAK.  Did you test this?


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

* Re: [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte()
  2020-04-19 10:26 ` [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() Matthew Wilcox
@ 2020-04-20  7:54   ` Michal Hocko
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2020-04-20  7:54 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: qiwuchen55, akpm, linux-mm, chenqiwu

On Sun 19-04-20 03:26:13, Matthew Wilcox wrote:
> On Sun, Apr 19, 2020 at 11:30:16AM +0800, qiwuchen55@gmail.com wrote:
> > From: chenqiwu <chenqiwu@xiaomi.com>
> > 
> > As discussed in patch[1], special mapping ptes such as device
> > mapping ptes don't need to operate on their corresponding pages,
> > so the redundant pte_devmap case can be removed.
> > 
> > [1] https://patchwork.kernel.org/patch/11494691/
> 
> This is a terrible changelog.  What it should say is something like:
> 
> Since commit 25b2995a35b6 ("mm: remove MEMORY_DEVICE_PUBLIC support"),
> the assignment to 'page' has been unnecessary.  Remove it.
> 
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

With this changelog, feel free to tadd
Acked-by: Michal Hocko <mhocko@suse.com>

> 
> > Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> > ---
> >  mm/memory.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index f703fe8..2143827 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -802,8 +802,6 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
> >  		get_page(page);
> >  		page_dup_rmap(page, false);
> >  		rss[mm_counter(page)]++;
> > -	} else if (pte_devmap(pte)) {
> > -		page = pte_page(pte);
> >  	}
> >  
> >  out_set_pte:
> > -- 
> > 1.9.1
> > 
> > 

-- 
Michal Hocko
SUSE Labs


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

end of thread, other threads:[~2020-04-20  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19  3:30 [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() qiwuchen55
2020-04-19  3:30 ` [PATCH 2/2] mm/memory: put refcount of normal page in zap_pte_range() qiwuchen55
2020-04-19 10:30   ` Matthew Wilcox
2020-04-19 10:26 ` [PATCH 1/2] mm/memory: remove redundant pte_devmap case for copy_one_pte() Matthew Wilcox
2020-04-20  7:54   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).