Re: [PATCH] mm/page_isolation: fix clang deadcode warning

From: Aiqun(Maria) Yu
Date: Thu Oct 20 2022 - 23:26:51 EST


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