mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used
Subsystems (2)
kernel test robot
build botHi 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Andrew Morton
maintainerQuoted 17 lines · On Sat, 05 Sep 2026 06:32:19 +0800 kernel test robot <[email protected]> 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 5 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
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:
mm/memory_hotplug.c renamed from mm/memory_hotplug.c~mm-memory_hotplug-factor-out-node_is_memoryless-fix +31 -30
@@ -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
_
Quoted 19 lines · Andrew Morton
Quoted 17 lines · On Sat, 05 Sep 2026 06:32:19 +0800 kernel test robot <[email protected]> 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 7 lines
Quoted 5 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
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