From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83FB4C433EF for ; Thu, 3 Mar 2022 11:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbiCCLtd (ORCPT ); Thu, 3 Mar 2022 06:49:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232991AbiCCLtY (ORCPT ); Thu, 3 Mar 2022 06:49:24 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97D40C9904; Thu, 3 Mar 2022 03:48:38 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K8Tf31kmczZdNk; Thu, 3 Mar 2022 19:43:55 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 3 Mar 2022 19:48:35 +0800 Subject: Re: [PATCH 4/8] mm: thp: only regular file could be THP eligible To: Dan Carpenter , Yang Shi CC: , , , , , , , , , , , , , , , , , References: <202203020034.2Ii9kTrs-lkp@intel.com> From: Miaohe Lin Message-ID: <6c8b9d6b-fc31-11d6-c5d4-c18b3854b4e9@huawei.com> Date: Thu, 3 Mar 2022 19:48:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <202203020034.2Ii9kTrs-lkp@intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/3/3 19:43, Dan Carpenter wrote: > Hi Yang, > > url: https://github.com/0day-ci/linux/commits/Yang-Shi/Make-khugepaged-collapse-readonly-FS-THP-more-consistent/20220301-075903 > base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev > config: arm64-randconfig-m031-20220227 (https://download.01.org/0day-ci/archive/20220302/202203020034.2Ii9kTrs-lkp@intel.com/config) > compiler: aarch64-linux-gcc (GCC) 11.2.0 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > > smatch warnings: > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereferenced before check 'vma->vm_file' (see line 177) > mm/khugepaged.c:468 hugepage_vma_check() error: we previously assumed 'vma->vm_file' could be null (see line 455) > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereferenced before check 'vma->vm_file' (see line 177) > > vim +179 include/linux/huge_mm.h > > 2224ed1155c07b Yang Shi 2022-02-28 175 static inline bool file_thp_enabled(struct vm_area_struct *vma) > 2224ed1155c07b Yang Shi 2022-02-28 176 { > 2224ed1155c07b Yang Shi 2022-02-28 @177 struct inode *inode = vma->vm_file->f_inode; > ^^^^^^^^^^^^^^ > Dereference. > > 2224ed1155c07b Yang Shi 2022-02-28 178 > 2224ed1155c07b Yang Shi 2022-02-28 @179 return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) && vma->vm_file && > ^^^^^^^^^^^^ > Checked too late. Yep. We should check vma->vm_file first before we access vma->vm_file->f_inode. Thanks. > > 2224ed1155c07b Yang Shi 2022-02-28 180 (vma->vm_flags & VM_EXEC) && > 2224ed1155c07b Yang Shi 2022-02-28 181 !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode); > 2224ed1155c07b Yang Shi 2022-02-28 182 } > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4715117064762051217==" MIME-Version: 1.0 From: Miaohe Lin To: kbuild-all@lists.01.org Subject: Re: [PATCH 4/8] mm: thp: only regular file could be THP eligible Date: Thu, 03 Mar 2022 19:48:35 +0800 Message-ID: <6c8b9d6b-fc31-11d6-c5d4-c18b3854b4e9@huawei.com> In-Reply-To: <202203020034.2Ii9kTrs-lkp@intel.com> List-Id: --===============4715117064762051217== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 2022/3/3 19:43, Dan Carpenter wrote: > Hi Yang, > = > url: https://github.com/0day-ci/linux/commits/Yang-Shi/Make-khugepaged= -collapse-readonly-FS-THP-more-consistent/20220301-075903 > base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev > config: arm64-randconfig-m031-20220227 (https://download.01.org/0day-ci/a= rchive/20220302/202203020034.2Ii9kTrs-lkp(a)intel.com/config) > compiler: aarch64-linux-gcc (GCC) 11.2.0 > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > = > smatch warnings: > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereference= d before check 'vma->vm_file' (see line 177) > mm/khugepaged.c:468 hugepage_vma_check() error: we previously assumed 'vm= a->vm_file' could be null (see line 455) > include/linux/huge_mm.h:179 file_thp_enabled() warn: variable dereference= d before check 'vma->vm_file' (see line 177) > = > vim +179 include/linux/huge_mm.h > = > 2224ed1155c07b Yang Shi 2022-02-28 175 static inline bool file_thp_= enabled(struct vm_area_struct *vma) > 2224ed1155c07b Yang Shi 2022-02-28 176 { > 2224ed1155c07b Yang Shi 2022-02-28 @177 struct inode *inode =3D vma= ->vm_file->f_inode; > ^^^= ^^^^^^^^^^^ > Dereference. > = > 2224ed1155c07b Yang Shi 2022-02-28 178 = > 2224ed1155c07b Yang Shi 2022-02-28 @179 return (IS_ENABLED(CONFIG_R= EAD_ONLY_THP_FOR_FS)) && vma->vm_file && > = ^^^^^^^^^^^^ > Checked too late. Yep. We should check vma->vm_file first before we access vma->vm_file->f_in= ode. Thanks. > = > 2224ed1155c07b Yang Shi 2022-02-28 180 (vma->vm_flags & VM_= EXEC) && > 2224ed1155c07b Yang Shi 2022-02-28 181 !inode_is_open_for_w= rite(inode) && S_ISREG(inode->i_mode); > 2224ed1155c07b Yang Shi 2022-02-28 182 } > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org > = > . >=20 --===============4715117064762051217==--