diff mbox series

[mm-unstable] mm/demotion: Fix build error with CONFIG_MIGRATION disabled

Message ID 20220830044210.17546-1-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series [mm-unstable] mm/demotion: Fix build error with CONFIG_MIGRATION disabled | expand

Commit Message

Aneesh Kumar K.V Aug. 30, 2022, 4:42 a.m. UTC
mm/memory-tiers.c: In function ‘toptier_nodes_show’:
mm/memory-tiers.c:647:49: error: ‘top_tier_adistance’ undeclared (first use in this function); did you mean ‘iov_iter_advance’?
  647 |                 if (memtier->adistance_start >= top_tier_adistance)
      |                                                 ^~~~~~~~~~~~~~~~~~
      |                                                 iov_iter_advance
mm/memory-tiers.c:647:49: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [scripts/Makefile.build:249: mm/memory-tiers.o] Error 1

Fixes: mm/demotion: Expose memory tier details via sysfs
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 mm/memory-tiers.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index d4648d4e4d54..b6c7e5987829 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -635,6 +635,7 @@  static int __meminit memtier_hotplug_callback(struct notifier_block *self,
 	return notifier_from_errno(0);
 }
 
+#ifdef CONFIG_MIGRATION
 static ssize_t toptier_nodes_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
@@ -654,6 +655,15 @@  static ssize_t toptier_nodes_show(struct device *dev,
 	mutex_unlock(&memory_tier_lock);
 	return ret;
 }
+#else
+static ssize_t toptier_nodes_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	nodemask_t top_tier_mask = node_states[N_MEMORY];
+
+	return sysfs_emit(buf, "%*pbl\n", nodemask_pr_args(&top_tier_mask));
+}
+#endif
 static DEVICE_ATTR_RO(toptier_nodes);
 
 static struct attribute *memtier_subsys_attrs[] = {