All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <yujie.liu@intel.com>
To: Hugh Dickins <hughd@google.com>
Cc: <llvm@lists.linux.dev>, <kbuild-all@lists.01.org>,
	"Linux Memory Management List" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 5970/6564] mm/huge_memory.c:2145:4: warning: Value stored to 'page' is never read [clang-analyzer-deadcode.DeadStores]
Date: Tue, 22 Feb 2022 17:05:09 +0800	[thread overview]
Message-ID: <ee50d553-e183-eaae-eed2-c4823a30f693@intel.com> (raw)
In-Reply-To: <202202220917.CFUvfxmY-lkp@intel.com>

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@intel.com/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@intel.com>


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@lists.01.org

      reply	other threads:[~2022-02-22  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  1:23 [linux-next:master 5970/6564] mm/huge_memory.c:2145:4: warning: Value stored to 'page' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2022-02-22  9:05 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee50d553-e183-eaae-eed2-c4823a30f693@intel.com \
    --to=yujie.liu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.