All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/page_isolation: fix clang deadcode warning
@ 2022-10-21  3:09 Maria Yu
  2022-10-21  3:11 ` kernel test robot
  2022-10-21  3:19 ` Matthew Wilcox
  0 siblings, 2 replies; 6+ messages in thread
From: Maria Yu @ 2022-10-21  3:09 UTC (permalink / raw)
  To: akpm, ziy, david, linux-kernel, linux-mm
  Cc: Maria Yu, mike.kravetz, opendmb, stable

When !CONFIG_VM_BUG_ON, there is warning of
clang-analyzer-deadcode.DeadStores:
Value stored to 'mt' during its initialization
is never read.

Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
---
 mm/page_isolation.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 04141a9bea70..51d5c8025f77 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -330,9 +330,7 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
 				      zone->zone_start_pfn);
 
 	if (skip_isolation) {
-		int mt = get_pageblock_migratetype(pfn_to_page(isolate_pageblock));
-
-		VM_BUG_ON(!is_migrate_isolate(mt));
+		VM_BUG_ON(!is_migrate_isolate(get_pageblock_migratetype(pfn_to_page(isolate_pageblock))));
 	} else {
 		ret = set_migratetype_isolate(pfn_to_page(isolate_pageblock), migratetype,
 				flags, isolate_pageblock, isolate_pageblock + pageblock_nr_pages);
-- 
2.17.1


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

* Re: [PATCH] mm/page_isolation: fix clang deadcode warning
  2022-10-21  3:09 [PATCH] mm/page_isolation: fix clang deadcode warning Maria Yu
@ 2022-10-21  3:11 ` kernel test robot
  2022-10-21  3:19 ` Matthew Wilcox
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-10-21  3:11 UTC (permalink / raw)
  To: Maria Yu; +Cc: stable, kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.'
Subject: [PATCH] mm/page_isolation: fix clang deadcode warning
Link: https://lore.kernel.org/stable/20221021030953.34925-1-quic_aiquny%40quicinc.com

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




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

* Re: [PATCH] mm/page_isolation: fix clang deadcode warning
  2022-10-21  3:09 [PATCH] mm/page_isolation: fix clang deadcode warning Maria Yu
  2022-10-21  3:11 ` kernel test robot
@ 2022-10-21  3:19 ` Matthew Wilcox
  2022-10-21  3:26   ` Aiqun(Maria) Yu
  1 sibling, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2022-10-21  3:19 UTC (permalink / raw)
  To: Maria Yu
  Cc: akpm, ziy, david, linux-kernel, linux-mm, mike.kravetz, opendmb, stable

On Fri, Oct 21, 2022 at 11:09:53AM +0800, Maria Yu wrote:
> When !CONFIG_VM_BUG_ON, there is warning of
> clang-analyzer-deadcode.DeadStores:
> Value stored to 'mt' during its initialization
> is never read.

Honestly, the cure is worse than the disease.  I'd rather not have a
line that's this long.

> -		int mt = get_pageblock_migratetype(pfn_to_page(isolate_pageblock));
> -
> -		VM_BUG_ON(!is_migrate_isolate(mt));
> +		VM_BUG_ON(!is_migrate_isolate(get_pageblock_migratetype(pfn_to_page(isolate_pageblock))));

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

* Re: [PATCH] mm/page_isolation: fix clang deadcode warning
  2022-10-21  3:19 ` Matthew Wilcox
@ 2022-10-21  3:26   ` Aiqun(Maria) Yu
  2022-10-21  4:17     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Aiqun(Maria) Yu @ 2022-10-21  3:26 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: akpm, ziy, david, linux-kernel, linux-mm, mike.kravetz, opendmb

On 10/21/2022 11:19 AM, Matthew Wilcox wrote:
> On Fri, Oct 21, 2022 at 11:09:53AM +0800, Maria Yu wrote:
>> When !CONFIG_VM_BUG_ON, there is warning of
>> clang-analyzer-deadcode.DeadStores:
>> Value stored to 'mt' during its initialization
>> is never read.
> 
> Honestly, the cure is worse than the disease.  I'd rather not have a
> line that's this long.
I don't like this long either. While the current Deadcode warning is 
also annoying for our clang tidy check.

will the CONFIG check can be acceptable?
like:
	#ifdef CONFIG_DEBUG_VM
or
	if (IS_ENABLED(CONFIG_DEBUG_VM))

Any good ideas?

> >> -		int mt = get_pageblock_migratetype(pfn_to_page(isolate_pageblock));
>> -
>> -		VM_BUG_ON(!is_migrate_isolate(mt));
>> +		VM_BUG_ON(!is_migrate_isolate(get_pageblock_migratetype(pfn_to_page(isolate_pageblock))));


-- 
Thx and BRs,
Aiqun(Maria) Yu

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

* Re: [PATCH] mm/page_isolation: fix clang deadcode warning
  2022-10-21  3:26   ` Aiqun(Maria) Yu
@ 2022-10-21  4:17     ` Andrew Morton
  2022-10-21  5:21       ` Aiqun(Maria) Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2022-10-21  4:17 UTC (permalink / raw)
  To: Aiqun(Maria) Yu
  Cc: Matthew Wilcox, ziy, david, linux-kernel, linux-mm, mike.kravetz,
	opendmb

On Fri, 21 Oct 2022 11:26:22 +0800 "Aiqun(Maria) Yu" <quic_aiquny@quicinc.com> wrote:

> > Honestly, the cure is worse than the disease.  I'd rather not have a
> > line that's this long.
> I don't like this long either. While the current Deadcode warning is 
> also annoying for our clang tidy check.
> 
> will the CONFIG check can be acceptable?
> like:
> 	#ifdef CONFIG_DEBUG_VM
> or
> 	if (IS_ENABLED(CONFIG_DEBUG_VM))
> 
> Any good ideas?

Put a newline in there?

Although the shortly following lines are nearly as long...

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

* Re: [PATCH] mm/page_isolation: fix clang deadcode warning
  2022-10-21  4:17     ` Andrew Morton
@ 2022-10-21  5:21       ` Aiqun(Maria) Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Aiqun(Maria) Yu @ 2022-10-21  5:21 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox, ziy, david, linux-kernel, linux-mm, mike.kravetz,
	opendmb

On 10/21/2022 12:17 PM, Andrew Morton wrote:
> On Fri, 21 Oct 2022 11:26:22 +0800 "Aiqun(Maria) Yu" <quic_aiquny@quicinc.com> wrote:
> 
>>> Honestly, the cure is worse than the disease.  I'd rather not have a
>>> line that's this long.
>> I don't like this long either. While the current Deadcode warning is
>> also annoying for our clang tidy check.
>>
>> will the CONFIG check can be acceptable?
>> like:
>> 	#ifdef CONFIG_DEBUG_VM
>> or
>> 	if (IS_ENABLED(CONFIG_DEBUG_VM))
>>
>> Any good ideas?
> 
> Put a newline in there?
> 
> Although the shortly following lines are nearly as long...
> 
Thx for the suggestion. new patchset uploaded.

-- 
Thx and BRs,
Aiqun(Maria) Yu

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

end of thread, other threads:[~2022-10-21  5:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21  3:09 [PATCH] mm/page_isolation: fix clang deadcode warning Maria Yu
2022-10-21  3:11 ` kernel test robot
2022-10-21  3:19 ` Matthew Wilcox
2022-10-21  3:26   ` Aiqun(Maria) Yu
2022-10-21  4:17     ` Andrew Morton
2022-10-21  5:21       ` Aiqun(Maria) Yu

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.