Message ID | 20221021030953.34925-1-quic_aiquny@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp455028wrr; Thu, 20 Oct 2022 20:12:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lw+6tFHU4JlSwt2jCAkNLtikubsa2ONa/8xTOx08RqBilevQRv5gHY6325eMKTi5DR5Y6 X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr15800020edb.252.1666321950431; Thu, 20 Oct 2022 20:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666321950; cv=none; d=google.com; s=arc-20160816; b=KUqiIBvjVvk1vR5iqFghXC602zjlUwWrl4LcLJdD0k5cneHk06zWSNYLjPn3K4cqCT oJfqCORUXUmLHgTnnE5dIM/1pKN0vSourv3ONy0Drbu3svCmLY3SNuAroTF9ibXa0F2U otwUqYOmHoU/Y1SbgqmeN+dp6Mc9OdfDxZAPxkxJeHMonoz7bfDCFa7l27dDrfN164R9 QVL/dNX+mLY4NHPY7SuEAAlzRLzWbA2GP4Ji1DFaoSEcnVPsGQeGd4GoTz7bK1KVvNIh ze6iSDIVMjN2EE6bWAodNJSn4YMb5wbjZ8VNnsEM1+y3RZz6oy64FPC3DKaDTg8N+iH2 R3zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=DsTItPlUtBGJbVGMl/Jdnss/A3xtazN0EmWPLV0xHSk=; b=B2x1Y0gwL+Hrim4vDoDWztE+/wDO0Ayny4S6V1ylWgwxwVx+NBVqoDNVi48TpkEDFT VDH/JhBnb/XmR+Gv4S2ss9u/7wWk+IYilGzQGiIiLGMaGkGFx7tyP0p5i+YclbO710Gf t3/nka2bEGGpzskZRGi66NeHl5jtaQFvS8Pu+FE1CDLMKs4Hx+ybXQO1fx0RtvLK+NGw QZgiT8t5KjjCfJYEvDvfDB97zhDb4pSDH3Lhw5CKtuc/Q61E5GbmXDRv3uLqB/55XdN5 cNTpVI56qSt4pceqvoTduboPJPoptUeep4lbgcBfdlEqYyDk7Dtpragh/FXNsh6HHJne c56w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="WL8/QEuS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu2-20020a170906a14200b0078103b6f8cbsi16456383ejb.318.2022.10.20.20.12.05; Thu, 20 Oct 2022 20:12:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="WL8/QEuS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbiJUDKd (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Thu, 20 Oct 2022 23:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbiJUDK0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Oct 2022 23:10:26 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8851FACF4C; Thu, 20 Oct 2022 20:10:21 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29L31J72008126; Fri, 21 Oct 2022 03:10:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=DsTItPlUtBGJbVGMl/Jdnss/A3xtazN0EmWPLV0xHSk=; b=WL8/QEuSWF/6Yw/gVnj7VLBTq/HZZ/+QDdGjjP6EgcpFGdLUmnoI/eKITgTvkoEy86O+ RGYAa74XnrafHBTmxW7OFzY4Zi+bU4UoESdlhJpsiGo2mXwVofF/Tbjfsh8LhuVS+bY5 5xwqiAHEUoB6ZhOe77Xj/ma+G8Ly5PmJ4a1cbAtp1xaeHDusfA+R1cRXz1IMaOHeB+XA H34sCiGhWFLFCqTa0sGwTgIyraxbhMVk0YbZtVGLP7hJXO1aJVCtUiVfhoQCUd1IOvWM 29IFeAYm2BmkRkTnqi/Zr0A7SxANepnmQvAxR5TNaRcVqlCvj5JlxAlX+zFZziRJWnyX bQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kawde3fu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Oct 2022 03:10:15 +0000 Received: from pps.filterd (NASANPPMTA04.qualcomm.com [127.0.0.1]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 29L38WhU016313; Fri, 21 Oct 2022 03:10:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA04.qualcomm.com (PPS) with ESMTPS id 3kbk40028n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Oct 2022 03:10:15 +0000 Received: from NASANPPMTA04.qualcomm.com (NASANPPMTA04.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29L374de015218; Fri, 21 Oct 2022 03:10:15 GMT Received: from nasanex01a.na.qualcomm.com ([10.52.223.231]) by NASANPPMTA04.qualcomm.com (PPS) with ESMTPS id 29L3AEtG018837 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Oct 2022 03:10:15 +0000 Received: from aiquny2-gv.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 20 Oct 2022 20:10:11 -0700 From: Maria Yu <quic_aiquny@quicinc.com> To: <akpm@linux-foundation.org>, <ziy@nvidia.com>, <david@redhat.com>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org> CC: Maria Yu <quic_aiquny@quicinc.com>, <mike.kravetz@oracle.com>, <opendmb@gmail.com>, <stable@vger.kernel.org> Subject: [PATCH] mm/page_isolation: fix clang deadcode warning Date: Fri, 21 Oct 2022 11:09:53 +0800 Message-ID: <20221021030953.34925-1-quic_aiquny@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: HqqFb_mtPIrkgfSpJYEGURS8f9LH0LXi X-Proofpoint-ORIG-GUID: HqqFb_mtPIrkgfSpJYEGURS8f9LH0LXi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-20_13,2022-10-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=660 malwarescore=0 clxscore=1011 phishscore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210210017 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747265205722036019?= X-GMAIL-MSGID: =?utf-8?q?1747265205722036019?= |
Series |
mm/page_isolation: fix clang deadcode warning
|
|
Commit Message
Aiqun Yu (Maria)
Oct. 21, 2022, 3:09 a.m. UTC
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(-)
Comments
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))));
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))));
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...
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.
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);