linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon: Remove redundant page validation
@ 2022-01-06 10:40 Baolin Wang
  2022-01-06 11:40 ` SeongJae Park
  0 siblings, 1 reply; 3+ messages in thread
From: Baolin Wang @ 2022-01-06 10:40 UTC (permalink / raw)
  To: sj, akpm; +Cc: dan.carpenter, baolin.wang, linux-mm, linux-kernel

It will never get a NULL page by pte_page(), 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.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 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] 3+ messages in thread

* Re: [PATCH] mm/damon: Remove redundant page validation
  2022-01-06 10:40 [PATCH] mm/damon: Remove redundant page validation Baolin Wang
@ 2022-01-06 11:40 ` SeongJae Park
  2022-01-06 13:02   ` Baolin Wang
  0 siblings, 1 reply; 3+ messages in thread
From: SeongJae Park @ 2022-01-06 11:40 UTC (permalink / raw)
  To: Baolin Wang; +Cc: sj, akpm, dan.carpenter, linux-mm, linux-kernel

Hi Baolin,


Thank you always for your great contribution!  As always, trivial comments
below.

On Thu, 6 Jan 2022 18:40:11 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:

> It will never get a NULL page by pte_page(), thus remove the redundant
> page validation to fix below Smatch static checker warning.

I guess the issue has reported in the open place[1], right?  I think it would
be better to add the link in this commit message, so that future readers can
read and learn from your discussion in the mail thread.

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

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

Sorry for continuously obsessing about this trivial and personal taste, but...
Could you please indent quoting blocks like above (hopefully with 4 spaces)?
That makes the message much easier to read for me, and I'd like to keep the
commit messages for DAMON consistent and easy to read, at least for me.

Other than that,

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
>  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	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/damon: Remove redundant page validation
  2022-01-06 11:40 ` SeongJae Park
@ 2022-01-06 13:02   ` Baolin Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Baolin Wang @ 2022-01-06 13:02 UTC (permalink / raw)
  To: SeongJae Park; +Cc: akpm, dan.carpenter, linux-mm, linux-kernel

Hi SeongJae,

On 1/6/2022 7:40 PM, SeongJae Park wrote:
> Hi Baolin,
> 
> 
> Thank you always for your great contribution!  As always, trivial comments
> below.
> 
> On Thu, 6 Jan 2022 18:40:11 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
> 
>> It will never get a NULL page by pte_page(), thus remove the redundant
>> page validation to fix below Smatch static checker warning.
> 
> I guess the issue has reported in the open place[1], right?  I think it would
> be better to add the link in this commit message, so that future readers can
> read and learn from your discussion in the mail thread.
> 
> [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/

OK.

> 
>>
>> mm/damon/vaddr.c:405 damon_hugetlb_mkold()
>> warn: 'page' can't be NULL.
> 
> Sorry for continuously obsessing about this trivial and personal taste, but...
> Could you please indent quoting blocks like above (hopefully with 4 spaces)?
> That makes the message much easier to read for me, and I'd like to keep the
> commit messages for DAMON consistent and easy to read, at least for me.

Sure, I will keep the rule of DAMON in mind.

Andrew, could you help to change the commit message format as SeongJae 
suggested when you apply this patch? Thanks.

> 
> Other than that,
> 
> Reviewed-by: SeongJae Park <sj@kernel.org>

Thanks.

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

end of thread, other threads:[~2022-01-06 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 10:40 [PATCH] mm/damon: Remove redundant page validation Baolin Wang
2022-01-06 11:40 ` SeongJae Park
2022-01-06 13:02   ` Baolin Wang

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).