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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF6CC433EF for ; Tue, 3 May 2022 17:54:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE80E6B00B2; Tue, 3 May 2022 13:54:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B93706B00B4; Tue, 3 May 2022 13:54:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BF4C6B00B2; Tue, 3 May 2022 13:54:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 8DB136B00AF for ; Tue, 3 May 2022 13:54:24 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 5C0BA1209CE for ; Tue, 3 May 2022 17:54:24 +0000 (UTC) X-FDA: 79425181248.07.71679E5 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf02.hostedemail.com (Postfix) with ESMTP id 93EFC80092 for ; Tue, 3 May 2022 17:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651600463; x=1683136463; h=date:from:to:cc:subject:message-id:mime-version; bh=FwXw44aqV98dHMXQU/mCFtT+K2bf2vat4clYQSiU+i8=; b=ItkFyKJbuUVgKFoP2YMgu3ORMXfMGUko/rMRYMK2gEADRattbV2VFT/u qGp2SSgKk9mKXtUmxpqs1rwOL6TXJaqLA+fSrg9rEEZ/XZSxLzfzyqf3r xja05VlZae2Ynwg4cEZRRhsV7wV8f1OnoU+CwF4jmYvdms+9DjHZLJSRM I1NOI3dhV7dukgM4ojNysNuJ6DNje0Fb3I5llHL4ZB0DGqzoE2aLio5UH IjpAH1ZzgS983uVDXWYxG/pMQDBmCwnpxVi7BihOoZJrFHBQvF3FGMb2r xRNdp8AJYEMe7lApBNQqSg23UMa2D3VucM6ypjTSu0gGAQVr7xm5uuas8 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10336"; a="292735056" X-IronPort-AV: E=Sophos;i="5.91,195,1647327600"; d="scan'208";a="292735056" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2022 10:54:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,195,1647327600"; d="scan'208";a="516663885" Received: from lkp-server01.sh.intel.com (HELO 5056e131ad90) ([10.239.97.150]) by orsmga003.jf.intel.com with ESMTP; 03 May 2022 10:54:20 -0700 Received: from kbuild by 5056e131ad90 with local (Exim 4.95) (envelope-from ) id 1nlwj5-000Ag3-QR; Tue, 03 May 2022 17:54:19 +0000 Date: Wed, 4 May 2022 01:53:20 +0800 From: kernel test robot To: "Matthew Wilcox (Oracle)" Cc: kbuild-all@lists.01.org, Linux Memory Management List , Andrew Morton Subject: [linux-next:master 7462/8237] mm/shmem.c:1761:12: warning: 'folio' is used uninitialized Message-ID: <202205040154.ijA4ofuQ-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ItkFyKJb; spf=none (imf02.hostedemail.com: domain of lkp@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 93EFC80092 X-Stat-Signature: jtp7byf5x6tokkgefu7j1q7i9qsc6ggr X-HE-Tag: 1651600458-814707 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 44a2f39e611ac0bc1f17c288a583d7f2e5684aa7 commit: 2b58b3f33ba268c00aa7181e203c58fab6661751 [7462/8237] mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio() config: sparc-randconfig-c023-20220501 (https://download.01.org/0day-ci/archive/20220504/202205040154.ijA4ofuQ-lkp@intel.com/config) compiler: sparc-linux-gcc (GCC) 11.3.0 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=2b58b3f33ba268c00aa7181e203c58fab6661751 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 2b58b3f33ba268c00aa7181e203c58fab6661751 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): mm/shmem.c: In function 'shmem_swapin_folio.constprop': >> mm/shmem.c:1761:12: warning: 'folio' is used uninitialized [-Wuninitialized] 1761 | if (folio) { | ^ In file included from : mm/shmem.c: In function 'shmem_add_to_page_cache.constprop': include/linux/compiler_types.h:352:45: error: call to '__compiletime_assert_256' declared with attribute error: BUILD_BUG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/compiler_types.h:333:25: note: in definition of macro '__compiletime_assert' 333 | prefix ## suffix(); \ | ^~~~~~ include/linux/compiler_types.h:352:9: note: in expansion of macro '_compiletime_assert' 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG' 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ include/linux/vm_event_item.h:147:27: note: in expansion of macro 'BUILD_BUG' 147 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ mm/shmem.c:743:40: note: in expansion of macro 'THP_FILE_ALLOC' 743 | count_vm_event(THP_FILE_ALLOC); | ^~~~~~~~~~~~~~ In file included from include/linux/math64.h:6, from include/linux/time64.h:5, from include/linux/restart_block.h:10, from include/linux/thread_info.h:14, from include/asm-generic/preempt.h:5, from ./arch/sparc/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:55, from include/linux/wait.h:9, from include/linux/wait_bit.h:8, from include/linux/fs.h:6, from mm/shmem.c:24: mm/shmem.c: In function 'shmem_getpage_gfp': include/linux/compiler_types.h:352:45: error: call to '__compiletime_assert_264' declared with attribute error: BUILD_BUG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/math.h:15:46: note: in definition of macro '__round_mask' 15 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ^ mm/shmem.c:1892:26: note: in expansion of macro 'round_down' 1892 | hindex = round_down(index, HPAGE_PMD_NR); | ^~~~~~~~~~ include/linux/compiler_types.h:340:9: note: in expansion of macro '__compiletime_assert' 340 | __compiletime_assert(condition, msg, prefix, suffix) | ^~~~~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:352:9: note: in expansion of macro '_compiletime_assert' 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG' 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ include/linux/huge_mm.h:307:28: note: in expansion of macro 'BUILD_BUG' 307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ include/linux/huge_mm.h:105:26: note: in expansion of macro 'HPAGE_PMD_SHIFT' 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ^~~~~~~~~~~~~~~ include/linux/huge_mm.h:106:26: note: in expansion of macro 'HPAGE_PMD_ORDER' 106 | #define HPAGE_PMD_NR (1<: include/linux/compiler_types.h:352:45: error: call to '__compiletime_assert_265' declared with attribute error: BUILD_BUG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/compiler_types.h:333:25: note: in definition of macro '__compiletime_assert' 333 | prefix ## suffix(); \ | ^~~~~~ include/linux/compiler_types.h:352:9: note: in expansion of macro '_compiletime_assert' 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG' 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ include/linux/huge_mm.h:307:28: note: in expansion of macro 'BUILD_BUG' 307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ include/linux/huge_mm.h:105:26: note: in expansion of macro 'HPAGE_PMD_SHIFT' 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ^~~~~~~~~~~~~~~ include/linux/huge_mm.h:106:26: note: in expansion of macro 'HPAGE_PMD_ORDER' 106 | #define HPAGE_PMD_NR (1<i_mapping; 1682 struct shmem_inode_info *info = SHMEM_I(inode); 1683 struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL; 1684 struct page *page; 1685 struct folio *folio; 1686 swp_entry_t swap; 1687 int error; 1688 1689 VM_BUG_ON(!*foliop || !xa_is_value(*foliop)); 1690 swap = radix_to_swp_entry(*foliop); 1691 *foliop = NULL; 1692 1693 /* Look it up and read it in.. */ 1694 page = lookup_swap_cache(swap, NULL, 0); 1695 if (!page) { 1696 /* Or update major stats only when swapin succeeds?? */ 1697 if (fault_type) { 1698 *fault_type |= VM_FAULT_MAJOR; 1699 count_vm_event(PGMAJFAULT); 1700 count_memcg_event_mm(charge_mm, PGMAJFAULT); 1701 } 1702 /* Here we actually start the io */ 1703 page = shmem_swapin(swap, gfp, info, index); 1704 if (!page) { 1705 error = -ENOMEM; 1706 goto failed; 1707 } 1708 } 1709 folio = page_folio(page); 1710 1711 /* We have to do this with page locked to prevent races */ 1712 folio_lock(folio); 1713 if (!folio_test_swapcache(folio) || 1714 folio_swap_entry(folio).val != swap.val || 1715 !shmem_confirm_swap(mapping, index, swap)) { 1716 error = -EEXIST; 1717 goto unlock; 1718 } 1719 if (!folio_test_uptodate(folio)) { 1720 error = -EIO; 1721 goto failed; 1722 } 1723 folio_wait_writeback(folio); 1724 1725 /* 1726 * Some architectures may have to restore extra metadata to the 1727 * folio after reading from swap. 1728 */ 1729 arch_swap_restore(swap, folio); 1730 1731 if (shmem_should_replace_folio(folio, gfp)) { 1732 error = shmem_replace_page(&page, gfp, info, index); 1733 if (error) 1734 goto failed; 1735 } 1736 1737 error = shmem_add_to_page_cache(folio, mapping, index, 1738 swp_to_radix_entry(swap), gfp, 1739 charge_mm); 1740 if (error) 1741 goto failed; 1742 1743 spin_lock_irq(&info->lock); 1744 info->swapped--; 1745 shmem_recalc_inode(inode); 1746 spin_unlock_irq(&info->lock); 1747 1748 if (sgp == SGP_WRITE) 1749 folio_mark_accessed(folio); 1750 1751 delete_from_swap_cache(&folio->page); 1752 folio_mark_dirty(folio); 1753 swap_free(swap); 1754 1755 *foliop = folio; 1756 return 0; 1757 failed: 1758 if (!shmem_confirm_swap(mapping, index, swap)) 1759 error = -EEXIST; 1760 unlock: > 1761 if (folio) { 1762 folio_unlock(folio); 1763 folio_put(folio); 1764 } 1765 1766 return error; 1767 } 1768 -- 0-DAY CI Kernel Test Service https://01.org/lkp