All of lore.kernel.org
 help / color / mirror / Atom feed
* [anolis-intel-cloud:devel-5.10 1/1] drivers/virtio/virtio_mem.c:2347:6: warning: no previous prototype for 'virtio_mem_sbm_unplug_any_sb_online_may_slow'
@ 2025-11-16  9:18 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-11-16  9:18 UTC (permalink / raw)
  To: aubrey.li; +Cc: oe-kbuild-all

tree:   https://gitee.com/anolis/intel-cloud-kernel.git devel-5.10
head:   ad3132d9450fb83553e3cee3961a4b5eb75dd355
commit: 2916febd5bc1263c3b0d0793eab0905f54e146e3 [1/1] anolis: virtio-mem: support unplugging free memory only
config: x86_64-anolis-intel-cloud-devel-5.10 (https://download.01.org/0day-ci/archive/20251116/202511161744.HyR3AxRq-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161744.HyR3AxRq-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511161744.HyR3AxRq-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/virtio/virtio_mem.c:2347:6: warning: no previous prototype for 'virtio_mem_sbm_unplug_any_sb_online_may_slow' [-Wmissing-prototypes]
    2347 | bool virtio_mem_sbm_unplug_any_sb_online_may_slow(struct virtio_mem *vm,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/virtio_mem_sbm_unplug_any_sb_online_may_slow +2347 drivers/virtio/virtio_mem.c

  2338	
  2339	/*
  2340	 * Pre-check if `virtio_mem_sbm_unplug_any_sb_online()` is slow.
  2341	 * If the memory is shared by many processes, `alloc_contig_range`
  2342	 * will be a time-consuming operation.
  2343	 *
  2344	 * Note: Currently, we consider it slow when the mapping count
  2345	 * exceeds 50% of the plugged page count.
  2346	 */
> 2347	bool virtio_mem_sbm_unplug_any_sb_online_may_slow(struct virtio_mem *vm,
  2348							  unsigned long mb_id)
  2349	{
  2350		unsigned long block_addr = virtio_mem_mb_id_to_phys(mb_id);
  2351		unsigned long block_start_pfn = PFN_DOWN(block_addr);
  2352		unsigned long pages_per_sb = PFN_DOWN(vm->sbm.sb_size);
  2353		unsigned long map_counts = 0, nr_plugged_pages = 0;
  2354		unsigned long pfn, pfn_end, order;
  2355		struct page *page;
  2356		int sb_id, count;
  2357	
  2358		for (sb_id = 0; sb_id < vm->sbm.sbs_per_mb; sb_id++) {
  2359			if (!virtio_mem_sbm_next_contig_plugged_sbs(vm, mb_id, &sb_id,
  2360								    &count))
  2361				break;
  2362	
  2363			nr_plugged_pages += count * pages_per_sb;
  2364			for (pfn = block_start_pfn + sb_id * pages_per_sb,
  2365			    pfn_end = pfn + count * pages_per_sb;
  2366			     pfn < pfn_end; pfn++) {
  2367				page = pfn_to_page(pfn);
  2368	
  2369				/* Skip free buddy pages */
  2370				if (PageBuddy(page)) {
  2371					order = READ_ONCE(page_private(page));
  2372					if (order < MAX_ORDER) {
  2373						pfn += (1UL << order) - 1;
  2374						continue;
  2375					}
  2376				}
  2377	
  2378				/* Only care head page of THP and hugetlb */
  2379				if (PageTransHuge(page)) {
  2380					order = compound_order(page);
  2381					if (order < MAX_ORDER)
  2382						pfn += (1UL << order) - 1;
  2383				}
  2384	
  2385				map_counts += page_mapcount(page);
  2386			}
  2387		}
  2388	
  2389		return (map_counts << 1) > nr_plugged_pages;
  2390	}
  2391	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-16  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-16  9:18 [anolis-intel-cloud:devel-5.10 1/1] drivers/virtio/virtio_mem.c:2347:6: warning: no previous prototype for 'virtio_mem_sbm_unplug_any_sb_online_may_slow' kernel test robot

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.