Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used
@ 2026-09-04 22:32 kernel test robot
  2026-09-05  1:56 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-09-04 22:32 UTC (permalink / raw)
  To: Gregory Price
  Cc: oe-kbuild-all, David Hildenbrand, Andrew Morton,
	Linux Memory Management List, mm-commits

Hi Gregory,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   e3fc12b08aadde9cec7b3799ac0e0c9a1aa245c4
commit: 77a622e07892674da28eb3ad349ddd96df10aded [301/316] mm/memory_hotplug: factor out node_is_memoryless()
config: x86_64-randconfig-161-20260904 (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-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/202609050628.ywCLhOj5-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used [-Wunused-function]
    1507 | static bool node_is_memoryless(int nid)
         |             ^~~~~~~~~~~~~~~~~~


vim +/node_is_memoryless +1507 mm/memory_hotplug.c

  1505	
  1506	/* Caller must hold the memory hotplug lock for this check. */
> 1507	static bool node_is_memoryless(int nid)
  1508	{
  1509		/*
  1510		 * A node still spanning pages (especially ZONE_DEVICE) is not
  1511		 * memoryless.  A node spans memory after move_pfn_range_to_zone(),
  1512		 * e.g. once a memory block has been onlined.
  1513		 */
  1514		if (node_spanned_pages(nid))
  1515			return false;
  1516		/*
  1517		 * Offline memory blocks may not be spanned by the node yet, but they
  1518		 * link to it in sysfs and can be onlined later, so the node is not
  1519		 * memoryless while any remain.
  1520		 */
  1521		return !for_each_memory_block(&nid, check_no_memblock_for_node_cb);
  1522	}
  1523	

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used
  2026-09-04 22:32 [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used kernel test robot
@ 2026-09-05  1:56 ` Andrew Morton
  2026-09-05 16:43   ` Gregory Price
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-09-05  1:56 UTC (permalink / raw)
  To: kernel test robot
  Cc: Gregory Price, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits

On Sat, 05 Sep 2026 06:32:19 +0800 kernel test robot <lkp@intel.com> wrote:

> Hi Gregory,
> 
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> head:   e3fc12b08aadde9cec7b3799ac0e0c9a1aa245c4
> commit: 77a622e07892674da28eb3ad349ddd96df10aded [301/316] mm/memory_hotplug: factor out node_is_memoryless()
> config: x86_64-randconfig-161-20260904 (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-lkp@intel.com/config)
> compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> smatch: v0.5.0-9187-g5189e3fb
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-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/202609050628.ywCLhOj5-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used [-Wunused-function]
>     1507 | static bool node_is_memoryless(int nid)
>          |             ^~~~~~~~~~~~~~~~~~

Thanks.  Let me try this:

--- a/mm/memory_hotplug.c~mm-memory_hotplug-factor-out-node_is_memoryless-fix
+++ a/mm/memory_hotplug.c
@@ -1491,36 +1491,6 @@ out:
 	return ret;
 }
 
-static int check_no_memblock_for_node_cb(struct memory_block *mem, void *arg)
-{
-	int nid = *(int *)arg;
-
-	/*
-	 * If a memory block belongs to multiple nodes, the stored nid is not
-	 * reliable. However, such blocks are always online (e.g., cannot get
-	 * offlined) and, therefore, are still spanned by the node.
-	 */
-	return mem->nid == nid ? -EEXIST : 0;
-}
-
-/* Caller must hold the memory hotplug lock for this check. */
-static bool node_is_memoryless(int nid)
-{
-	/*
-	 * A node still spanning pages (especially ZONE_DEVICE) is not
-	 * memoryless.  A node spans memory after move_pfn_range_to_zone(),
-	 * e.g. once a memory block has been onlined.
-	 */
-	if (node_spanned_pages(nid))
-		return false;
-	/*
-	 * Offline memory blocks may not be spanned by the node yet, but they
-	 * link to it in sysfs and can be onlined later, so the node is not
-	 * memoryless while any remain.
-	 */
-	return !for_each_memory_block(&nid, check_no_memblock_for_node_cb);
-}
-
 /*
  * NOTE: The caller must call lock_device_hotplug() to serialize hotplug
  * and online/offline operations (triggered e.g. by sysfs).
@@ -1815,6 +1785,37 @@ bool mhp_range_allowed(u64 start, u64 si
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
+
+static int check_no_memblock_for_node_cb(struct memory_block *mem, void *arg)
+{
+	int nid = *(int *)arg;
+
+	/*
+	 * If a memory block belongs to multiple nodes, the stored nid is not
+	 * reliable. However, such blocks are always online (e.g., cannot get
+	 * offlined) and, therefore, are still spanned by the node.
+	 */
+	return mem->nid == nid ? -EEXIST : 0;
+}
+
+/* Caller must hold the memory hotplug lock for this check. */
+static bool node_is_memoryless(int nid)
+{
+	/*
+	 * A node still spanning pages (especially ZONE_DEVICE) is not
+	 * memoryless.  A node spans memory after move_pfn_range_to_zone(),
+	 * e.g. once a memory block has been onlined.
+	 */
+	if (node_spanned_pages(nid))
+		return false;
+	/*
+	 * Offline memory blocks may not be spanned by the node yet, but they
+	 * link to it in sysfs and can be onlined later, so the node is not
+	 * memoryless while any remain.
+	 */
+	return !for_each_memory_block(&nid, check_no_memblock_for_node_cb);
+}
+
 /*
  * Scan pfn range [start,end) to find movable/migratable pages (LRU and
  * hugetlb folio, movable_ops pages). Will skip over most unmovable
_



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used
  2026-09-05  1:56 ` Andrew Morton
@ 2026-09-05 16:43   ` Gregory Price
  0 siblings, 0 replies; 3+ messages in thread
From: Gregory Price @ 2026-09-05 16:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits

On Fri, Sep 04, 2026 at 06:56:58PM -0700, Andrew Morton wrote:
> On Sat, 05 Sep 2026 06:32:19 +0800 kernel test robot <lkp@intel.com> wrote:
> 
> > Hi Gregory,
> > 
> > FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> > head:   e3fc12b08aadde9cec7b3799ac0e0c9a1aa245c4
> > commit: 77a622e07892674da28eb3ad349ddd96df10aded [301/316] mm/memory_hotplug: factor out node_is_memoryless()
> > config: x86_64-randconfig-161-20260904 (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-lkp@intel.com/config)
> > compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> > smatch: v0.5.0-9187-g5189e3fb
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260905/202609050628.ywCLhOj5-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/202609050628.ywCLhOj5-lkp@intel.com/
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used [-Wunused-function]
> >     1507 | static bool node_is_memoryless(int nid)
> >          |             ^~~~~~~~~~~~~~~~~~
> 
> Thanks.  Let me try this:

Thanks Andrew, sorry for the churn.

~GRegory



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-05 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 22:32 [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used kernel test robot
2026-09-05  1:56 ` Andrew Morton
2026-09-05 16:43   ` Gregory Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox