lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202308251315.UUQoJwKC-lkp@intel.com>
Date:   Fri, 25 Aug 2023 13:25:22 +0800
From:   kernel test robot <lkp@...el.com>
To:     Xin Hao <haoxing990@...il.com>, yuzhao@...gle.com
Cc:     oe-kbuild-all@...ts.linux.dev, akpm@...ux-foundation.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        haoxing990@...il.com, Vern Hao <vernhao@...cent.com>
Subject: Re: [PATCH] mm: multi-gen LRU: Optimize some duplicate codes

Hi Xin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Xin-Hao/mm-multi-gen-LRU-Optimize-some-duplicate-codes/20230824-193855
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20230824113538.5160-1-user%40VERNHAO-MC1
patch subject: [PATCH] mm: multi-gen LRU: Optimize some duplicate codes
config: openrisc-randconfig-r025-20230825 (https://download.01.org/0day-ci/archive/20230825/202308251315.UUQoJwKC-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230825/202308251315.UUQoJwKC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308251315.UUQoJwKC-lkp@intel.com/

All warnings (new ones prefixed by >>):

   mm/vmscan.c: In function 'lru_gen_look_around':
>> mm/vmscan.c:4681:14: warning: unused variable 'can_swap' [-Wunused-variable]
    4681 |         bool can_swap = !folio_is_file_lru(folio);
         |              ^~~~~~~~


vim +/can_swap +4681 mm/vmscan.c

ac35a490237446 Yu Zhao                 2022-09-18  4659  
db19a43d9b3a88 T.J. Alumbaugh          2023-01-18  4660  /******************************************************************************
db19a43d9b3a88 T.J. Alumbaugh          2023-01-18  4661   *                          rmap/PT walk feedback
db19a43d9b3a88 T.J. Alumbaugh          2023-01-18  4662   ******************************************************************************/
db19a43d9b3a88 T.J. Alumbaugh          2023-01-18  4663  
018ee47f14893d Yu Zhao                 2022-09-18  4664  /*
49fd9b6df54e61 Matthew Wilcox (Oracle  2022-09-02  4665)  * This function exploits spatial locality when shrink_folio_list() walks the
bd74fdaea14602 Yu Zhao                 2022-09-18  4666   * rmap. It scans the adjacent PTEs of a young PTE and promotes hot pages. If
bd74fdaea14602 Yu Zhao                 2022-09-18  4667   * the scan was done cacheline efficiently, it adds the PMD entry pointing to
bd74fdaea14602 Yu Zhao                 2022-09-18  4668   * the PTE table to the Bloom filter. This forms a feedback loop between the
bd74fdaea14602 Yu Zhao                 2022-09-18  4669   * eviction and the aging.
018ee47f14893d Yu Zhao                 2022-09-18  4670   */
018ee47f14893d Yu Zhao                 2022-09-18  4671  void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
018ee47f14893d Yu Zhao                 2022-09-18  4672  {
018ee47f14893d Yu Zhao                 2022-09-18  4673  	int i;
018ee47f14893d Yu Zhao                 2022-09-18  4674  	unsigned long start;
018ee47f14893d Yu Zhao                 2022-09-18  4675  	unsigned long end;
bd74fdaea14602 Yu Zhao                 2022-09-18  4676  	struct lru_gen_mm_walk *walk;
bd74fdaea14602 Yu Zhao                 2022-09-18  4677  	int young = 0;
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4678  	pte_t *pte = pvmw->pte;
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4679  	unsigned long addr = pvmw->address;
018ee47f14893d Yu Zhao                 2022-09-18  4680  	struct folio *folio = pfn_folio(pvmw->pfn);
a3235ea2a88b78 Kalesh Singh            2023-08-01 @4681  	bool can_swap = !folio_is_file_lru(folio);
018ee47f14893d Yu Zhao                 2022-09-18  4682  	struct mem_cgroup *memcg = folio_memcg(folio);
018ee47f14893d Yu Zhao                 2022-09-18  4683  	struct pglist_data *pgdat = folio_pgdat(folio);
018ee47f14893d Yu Zhao                 2022-09-18  4684  	struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
018ee47f14893d Yu Zhao                 2022-09-18  4685  	DEFINE_MAX_SEQ(lruvec);
5eaa8481da76b4 Vern Hao                2023-08-24  4686  	int new_gen = lru_gen_from_seq(max_seq);
5eaa8481da76b4 Vern Hao                2023-08-24  4687  	int old_count = 0;
018ee47f14893d Yu Zhao                 2022-09-18  4688  
018ee47f14893d Yu Zhao                 2022-09-18  4689  	lockdep_assert_held(pvmw->ptl);
018ee47f14893d Yu Zhao                 2022-09-18  4690  	VM_WARN_ON_ONCE_FOLIO(folio_test_lru(folio), folio);
018ee47f14893d Yu Zhao                 2022-09-18  4691  
018ee47f14893d Yu Zhao                 2022-09-18  4692  	if (spin_is_contended(pvmw->ptl))
018ee47f14893d Yu Zhao                 2022-09-18  4693  		return;
018ee47f14893d Yu Zhao                 2022-09-18  4694  
bd74fdaea14602 Yu Zhao                 2022-09-18  4695  	/* avoid taking the LRU lock under the PTL when possible */
bd74fdaea14602 Yu Zhao                 2022-09-18  4696  	walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL;
bd74fdaea14602 Yu Zhao                 2022-09-18  4697  
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4698  	start = max(addr & PMD_MASK, pvmw->vma->vm_start);
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4699  	end = min(addr | ~PMD_MASK, pvmw->vma->vm_end - 1) + 1;
018ee47f14893d Yu Zhao                 2022-09-18  4700  
018ee47f14893d Yu Zhao                 2022-09-18  4701  	if (end - start > MIN_LRU_BATCH * PAGE_SIZE) {
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4702  		if (addr - start < MIN_LRU_BATCH * PAGE_SIZE / 2)
018ee47f14893d Yu Zhao                 2022-09-18  4703  			end = start + MIN_LRU_BATCH * PAGE_SIZE;
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4704  		else if (end - addr < MIN_LRU_BATCH * PAGE_SIZE / 2)
018ee47f14893d Yu Zhao                 2022-09-18  4705  			start = end - MIN_LRU_BATCH * PAGE_SIZE;
018ee47f14893d Yu Zhao                 2022-09-18  4706  		else {
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4707  			start = addr - MIN_LRU_BATCH * PAGE_SIZE / 2;
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4708  			end = addr + MIN_LRU_BATCH * PAGE_SIZE / 2;
018ee47f14893d Yu Zhao                 2022-09-18  4709  		}
018ee47f14893d Yu Zhao                 2022-09-18  4710  	}
018ee47f14893d Yu Zhao                 2022-09-18  4711  
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4712  	/* folio_update_gen() requires stable folio_memcg() */
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4713  	if (!mem_cgroup_trylock_pages(memcg))
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4714  		return;
018ee47f14893d Yu Zhao                 2022-09-18  4715  
018ee47f14893d Yu Zhao                 2022-09-18  4716  	arch_enter_lazy_mmu_mode();
018ee47f14893d Yu Zhao                 2022-09-18  4717  
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4718  	pte -= (addr - start) / PAGE_SIZE;
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4719  
018ee47f14893d Yu Zhao                 2022-09-18  4720  	for (i = 0, addr = start; addr != end; i++, addr += PAGE_SIZE) {
5eaa8481da76b4 Vern Hao                2023-08-24  4721  		if (!lru_gen_folio_status_check(pte + i, pvmw->vma, pgdat,
5eaa8481da76b4 Vern Hao                2023-08-24  4722  						addr, new_gen, &old_count, walk, memcg))
018ee47f14893d Yu Zhao                 2022-09-18  4723  			continue;
bd74fdaea14602 Yu Zhao                 2022-09-18  4724  		young++;
018ee47f14893d Yu Zhao                 2022-09-18  4725  	}
018ee47f14893d Yu Zhao                 2022-09-18  4726  
018ee47f14893d Yu Zhao                 2022-09-18  4727  	arch_leave_lazy_mmu_mode();
abf086721a2f1e T.J. Alumbaugh          2023-01-18  4728  	mem_cgroup_unlock_pages();
018ee47f14893d Yu Zhao                 2022-09-18  4729  
bd74fdaea14602 Yu Zhao                 2022-09-18  4730  	/* feedback from rmap walkers to page table walkers */
bd74fdaea14602 Yu Zhao                 2022-09-18  4731  	if (suitable_to_scan(i, young))
bd74fdaea14602 Yu Zhao                 2022-09-18  4732  		update_bloom_filter(lruvec, max_seq, pvmw->pmd);
018ee47f14893d Yu Zhao                 2022-09-18  4733  }
018ee47f14893d Yu Zhao                 2022-09-18  4734  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ