[PATCH WIP v1 15/20] mm/rmap_id: verify precalculated subids with CONFIG_DEBUG_VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's verify the precalculated subids for 4/5/6 values.

Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux