From: Andrew Morton <akpm@linux-foundation.org>
To: kernel test robot <lkp@intel.com>
Cc: Gregory Price <gourry@gourry.net>,
oe-kbuild-all@lists.linux.dev,
David Hildenbrand <david@kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>,
mm-commits@vger.kernel.org
Subject: Re: [akpm-mm:mm-new 301/316] mm/memory_hotplug.c:1507:13: warning: 'node_is_memoryless' defined but not used
Date: Fri, 4 Sep 2026 18:56:58 -0700 [thread overview]
Message-ID: <20260904185658.cb3316b1d54ab7320620c26f@linux-foundation.org> (raw)
In-Reply-To: <202609050628.ywCLhOj5-lkp@intel.com>
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
_
next prev parent reply other threads:[~2026-09-05 1:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-09-05 16:43 ` Gregory Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260904185658.cb3316b1d54ab7320620c26f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=mm-commits@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.