All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm/damon: Remove redundant page validation
@ 2022-01-17  2:34 Baolin Wang
  2022-01-24 18:20 ` David Rientjes
  2022-01-25  3:43 ` Miaohe Lin
  0 siblings, 2 replies; 4+ messages in thread
From: Baolin Wang @ 2022-01-17  2:34 UTC (permalink / raw)
  To: sj, akpm; +Cc: baolin.wang, linux-mm, linux-kernel

It will never get a NULL page by pte_page() as discussed in thread [1],
thus remove the redundant page validation to fix below Smatch static
checker warning.

    mm/damon/vaddr.c:405 damon_hugetlb_mkold()
    warn: 'page' can't be NULL.

[1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
Changes from v1:
 - Improve the commit message suggested by SeongJae.
 - Add reviewed-by tag from SeongJae.
---
 mm/damon/vaddr.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 89b6468d..8a52e00 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -402,9 +402,6 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
 	pte_t entry = huge_ptep_get(pte);
 	struct page *page = pte_page(entry);
 
-	if (!page)
-		return;
-
 	get_page(page);
 
 	if (pte_young(entry)) {
@@ -564,9 +561,6 @@ static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask,
 		goto out;
 
 	page = pte_page(entry);
-	if (!page)
-		goto out;
-
 	get_page(page);
 
 	if (pte_young(entry) || !page_is_idle(page) ||
-- 
1.8.3.1


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

* Re: [PATCH v2] mm/damon: Remove redundant page validation
  2022-01-17  2:34 [PATCH v2] mm/damon: Remove redundant page validation Baolin Wang
@ 2022-01-24 18:20 ` David Rientjes
  2022-01-25  3:09   ` Souptick Joarder
  2022-01-25  3:43 ` Miaohe Lin
  1 sibling, 1 reply; 4+ messages in thread
From: David Rientjes @ 2022-01-24 18:20 UTC (permalink / raw)
  To: Baolin Wang; +Cc: sj, akpm, linux-mm, linux-kernel

On Mon, 17 Jan 2022, Baolin Wang wrote:

> It will never get a NULL page by pte_page() as discussed in thread [1],
> thus remove the redundant page validation to fix below Smatch static
> checker warning.
> 
>     mm/damon/vaddr.c:405 damon_hugetlb_mkold()
>     warn: 'page' can't be NULL.
> 
> [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Reviewed-by: SeongJae Park <sj@kernel.org>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH v2] mm/damon: Remove redundant page validation
  2022-01-24 18:20 ` David Rientjes
@ 2022-01-25  3:09   ` Souptick Joarder
  0 siblings, 0 replies; 4+ messages in thread
From: Souptick Joarder @ 2022-01-25  3:09 UTC (permalink / raw)
  To: David Rientjes; +Cc: Baolin Wang, sj, Andrew Morton, Linux-MM, linux-kernel

On Mon, Jan 24, 2022 at 11:50 PM David Rientjes <rientjes@google.com> wrote:
>
> On Mon, 17 Jan 2022, Baolin Wang wrote:
>
> > It will never get a NULL page by pte_page() as discussed in thread [1],
> > thus remove the redundant page validation to fix below Smatch static
> > checker warning.
> >
> >     mm/damon/vaddr.c:405 damon_hugetlb_mkold()
> >     warn: 'page' can't be NULL.
> >
> > [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/
> >
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> > Reviewed-by: SeongJae Park <sj@kernel.org>
>
> Acked-by: David Rientjes <rientjes@google.com>

Acked-by: Souptick Joarder <jrdr.linux@gmail.com>

>

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

* Re: [PATCH v2] mm/damon: Remove redundant page validation
  2022-01-17  2:34 [PATCH v2] mm/damon: Remove redundant page validation Baolin Wang
  2022-01-24 18:20 ` David Rientjes
@ 2022-01-25  3:43 ` Miaohe Lin
  1 sibling, 0 replies; 4+ messages in thread
From: Miaohe Lin @ 2022-01-25  3:43 UTC (permalink / raw)
  To: Baolin Wang; +Cc: linux-mm, linux-kernel, sj, Andrew Morton

On 2022/1/17 10:34, Baolin Wang wrote:
> It will never get a NULL page by pte_page() as discussed in thread [1],
> thus remove the redundant page validation to fix below Smatch static
> checker warning.
> 
>     mm/damon/vaddr.c:405 damon_hugetlb_mkold()
>     warn: 'page' can't be NULL.
> 
> [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Reviewed-by: SeongJae Park <sj@kernel.org>

LGTM. Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

> ---
> Changes from v1:
>  - Improve the commit message suggested by SeongJae.
>  - Add reviewed-by tag from SeongJae.
> ---
>  mm/damon/vaddr.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 89b6468d..8a52e00 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -402,9 +402,6 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
>  	pte_t entry = huge_ptep_get(pte);
>  	struct page *page = pte_page(entry);
>  
> -	if (!page)
> -		return;
> -
>  	get_page(page);
>  
>  	if (pte_young(entry)) {
> @@ -564,9 +561,6 @@ static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask,
>  		goto out;
>  
>  	page = pte_page(entry);
> -	if (!page)
> -		goto out;
> -
>  	get_page(page);
>  
>  	if (pte_young(entry) || !page_is_idle(page) ||
> 


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

end of thread, other threads:[~2022-01-25  7:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17  2:34 [PATCH v2] mm/damon: Remove redundant page validation Baolin Wang
2022-01-24 18:20 ` David Rientjes
2022-01-25  3:09   ` Souptick Joarder
2022-01-25  3:43 ` Miaohe Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.