[linux-next:master 5970/6564] mm/huge_memory.c:2145:4: warning: Value stored to 'page' is never read [clang-analyzer-deadcode.DeadStores]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   3c30cf91b5ecc7272b3d2942ae0505dd8320b81c
commit: c1879365d325d0f44337fedcfffe8bf200092f95 [5970/6564] mm/munlock: rmap call mlock_vma_page() munlock_vma_page()
config: x86_64-randconfig-c007-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220917.CFUvfxmY-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=c1879365d325d0f44337fedcfffe8bf200092f95
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout c1879365d325d0f44337fedcfffe8bf200092f95
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> mm/huge_memory.c:2145:4: warning: Value stored to 'page' is never read [clang-analyzer-deadcode.DeadStores]
                           page = pmd_page(*pmd);
                           ^

vim +/page +2145 mm/huge_memory.c

eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2119
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2120  void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
33f4751e99601b Naoya Horiguchi    2016-07-14  2121  		unsigned long address, bool freeze, struct page *page)
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2122  {
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2123  	spinlock_t *ptl;
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2124  	struct mmu_notifier_range range;
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2125
7269f999934b28 Jérôme Glisse      2019-05-13  2126  	mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm,
6f4f13e8d9e27c Jérôme Glisse      2019-05-13  2127  				address & HPAGE_PMD_MASK,
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2128  				(address & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE);
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2129  	mmu_notifier_invalidate_range_start(&range);
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2130  	ptl = pmd_lock(vma->vm_mm, pmd);
33f4751e99601b Naoya Horiguchi    2016-07-14  2131
33f4751e99601b Naoya Horiguchi    2016-07-14  2132  	/*
33f4751e99601b Naoya Horiguchi    2016-07-14  2133  	 * If caller asks to setup a migration entries, we need a page to check
33f4751e99601b Naoya Horiguchi    2016-07-14  2134  	 * pmd against. Otherwise we can end up replacing wrong page.
33f4751e99601b Naoya Horiguchi    2016-07-14  2135  	 */
33f4751e99601b Naoya Horiguchi    2016-07-14  2136  	VM_BUG_ON(freeze && !page);
c444eb564fb166 Andrea Arcangeli   2020-05-27  2137  	if (page) {
c444eb564fb166 Andrea Arcangeli   2020-05-27  2138  		VM_WARN_ON_ONCE(!PageLocked(page));
c444eb564fb166 Andrea Arcangeli   2020-05-27  2139  		if (page != pmd_page(*pmd))
33f4751e99601b Naoya Horiguchi    2016-07-14  2140  			goto out;
c444eb564fb166 Andrea Arcangeli   2020-05-27  2141  	}
33f4751e99601b Naoya Horiguchi    2016-07-14  2142
5c7fb56e5e3f70 Dan Williams       2016-01-15  2143  	if (pmd_trans_huge(*pmd)) {
dbe67be3d9f30a David Hildenbrand  2022-02-16  2144  		if (!page)
33f4751e99601b Naoya Horiguchi    2016-07-14 @2145  			page = pmd_page(*pmd);
84c3fc4e9c563d Zi Yan             2017-09-08  2146  	} else if (!(pmd_devmap(*pmd) || is_pmd_migration_entry(*pmd)))
5c7fb56e5e3f70 Dan Williams       2016-01-15  2147  		goto out;
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2148  	__split_huge_pmd_locked(vma, pmd, range.start, freeze);
e90309c9f7722d Kirill A. Shutemov 2016-01-15  2149  out:
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2150  	spin_unlock(ptl);
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2151  	/*
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2152  	 * No need to double call mmu_notifier->invalidate_range() callback.
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2153  	 * They are 3 cases to consider inside __split_huge_pmd_locked():
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2154  	 *  1) pmdp_huge_clear_flush_notify() call invalidate_range() obvious
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2155  	 *  2) __split_huge_zero_page_pmd() read only zero page and any write
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2156  	 *    fault will trigger a flush_notify before pointing to a new page
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2157  	 *    (it is fine if the secondary mmu keeps pointing to the old zero
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2158  	 *    page in the meantime)
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2159  	 *  3) Split a huge pmd into pte pointing to the same page. No need
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2160  	 *     to invalidate secondary tlb entry they are all still valid.
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2161  	 *     any further changes to individual pte will notify. So no need
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2162  	 *     to call mmu_notifier->invalidate_range()
4645b9fe84bf48 Jérôme Glisse      2017-11-15  2163  	 */
ac46d4f3c43241 Jérôme Glisse      2018-12-28  2164  	mmu_notifier_invalidate_range_only_end(&range);
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2165  }
eef1b3ba053aa6 Kirill A. Shutemov 2016-01-15  2166

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux