lkml.org 
[lkml]   [2023]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH WIP v1 15/20] mm/rmap_id: verify precalculated subids with CONFIG_DEBUG_VM
Date
Let's verify the precalculated subids for 4/5/6 values.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
mm/rmap_id.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/mm/rmap_id.c b/mm/rmap_id.c
index 6c3187547741..421d8d2b646c 100644
--- a/mm/rmap_id.c
+++ b/mm/rmap_id.c
@@ -481,3 +481,29 @@ void free_rmap_id(int id)
ida_free(&rmap_ida, id);
spin_unlock(&rmap_id_lock);
}
+
+#ifdef CONFIG_DEBUG_VM
+static int __init rmap_id_init(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(rmap_subids_4); i++)
+ WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_4_MAX_ORDER, i) !=
+ rmap_subids_4[i]);
+
+#if MAX_ORDER >= RMAP_SUBID_5_MIN_ORDER
+ for (i = 0; i < ARRAY_SIZE(rmap_subids_5); i++)
+ WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_5_MAX_ORDER, i) !=
+ rmap_subids_5[i]);
+#endif
+
+#if MAX_ORDER >= RMAP_SUBID_6_MIN_ORDER
+ for (i = 0; i < ARRAY_SIZE(rmap_subids_6); i++)
+ WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_6_MAX_ORDER, i) !=
+ rmap_subids_6[i]);
+#endif
+
+ return 0;
+}
+module_init(rmap_id_init)
+#endif /* CONFIG_DEBUG_VM */
--
2.41.0
\
 
 \ /
  Last update: 2023-11-24 14:29    [W:3.521 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site